Skip to content

Build srt-1-fit fails with standard attributes in middle of decl-specifiers on GCC 12 #3155

@hashworks

Description

@hashworks

I'm currently trying to build the latest develop commit 29ae29c, but it fails with standard attributes in middle of decl-specifiers.

cd trunk
./configure
make
[ 37%] Building CXX object CMakeFiles/srt_virtual.dir/srtcore/api.cpp.o
In file included from trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/api.h:60,
                 from trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/api.cpp:60:
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/netinet_any.h: In constructor ‘sockaddr_any::sockaddr_any(int)’:
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/netinet_any.h:40:15: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct sockaddr_any’; use assignment or value-initialization instead [-Wclass-memaccess]
   40 |         memset(this, 0, sizeof *this);
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/netinet_any.h:28:8: note: ‘struct sockaddr_any’ declared here
   28 | struct sockaddr_any
      |        ^~~~~~~~~~~~
In file included from trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/udt.h:70,
                 from trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/api.h:61:
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h: At global scope:
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:84:28: error: standard attributes in middle of decl-specifiers
   84 | #define SRT_ATR_DEPRECATED [[deprecated]]
      |                            ^
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:198:9: note: in expansion of macro ‘SRT_ATR_DEPRECATED’
  198 | typedef SRT_ATR_DEPRECATED SRT_SOCKOPT SRT_SOCKOPT_DEPRECATED;
      |         ^~~~~~~~~~~~~~~~~~
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:84:28: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
   84 | #define SRT_ATR_DEPRECATED [[deprecated]]
      |                            ^
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:198:9: note: in expansion of macro ‘SRT_ATR_DEPRECATED’
  198 | typedef SRT_ATR_DEPRECATED SRT_SOCKOPT SRT_SOCKOPT_DEPRECATED;
      |         ^~~~~~~~~~~~~~~~~~
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:84:28: warning: attribute ignored [-Wattributes]
   84 | #define SRT_ATR_DEPRECATED [[deprecated]]
      |                            ^
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:198:9: note: in expansion of macro ‘SRT_ATR_DEPRECATED’
  198 | typedef SRT_ATR_DEPRECATED SRT_SOCKOPT SRT_SOCKOPT_DEPRECATED;
      |         ^~~~~~~~~~~~~~~~~~
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:84:28: note: an attribute that appertains to a type-specifier is ignored
   84 | #define SRT_ATR_DEPRECATED [[deprecated]]
      |                            ^
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:198:9: note: in expansion of macro ‘SRT_ATR_DEPRECATED’
  198 | typedef SRT_ATR_DEPRECATED SRT_SOCKOPT SRT_SOCKOPT_DEPRECATED;
      |         ^~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/srt_virtual.dir/build.make:76: CMakeFiles/srt_virtual.dir/srtcore/api.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:113: CMakeFiles/srt_virtual.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Build srt-1-fit failed, ret=2

I searched around a bit, it seems this is related to GCC 12. But I'm not a C++ developer, so take this with a grain of salt.

Any idea?

Metadata

Metadata

Assignees

Labels

EnglishNativeThis issue is conveyed exclusively in English.Won't fixWe won't fix it.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions