I just spent like a whole hour until I realized that cpp defines "linux" which gives this confusing error: src/systemctl/bootspec.h:40:15: error: expected identifier or ‘(’ before numeric constant char *linux; ^ We should remove these defines from gcc 5, and force programs to check __unix__ and __linux__
bcc76966 (ghazi 2003-11-29 03:08:13 +0000 45) builtin_define_std ("linux"); \ bcc76966 (ghazi 2003-11-29 03:08:13 +0000 46) builtin_define_std ("unix"); \
They are indeed legacy defines. More affected systems: dragonfly.h: builtin_define_std ("unix"); \ freebsd-spec.h: builtin_define_std ("unix"); \ gnu.h: builtin_define_std ("unix"); \ kfreebsd-gnu.h: builtin_define_std ("unix"); \ knetbsd-gnu.h: builtin_define_std ("unix"); \ kopensolaris-gnu.h: builtin_define_std ("unix"); \ linux.h: builtin_define_std ("linux"); \ linux.h: builtin_define_std ("unix"); \ sol2.h: builtin_define_std ("unix"); \ sol2.h: builtin_define_std ("sun"); \
Created attachment 34892 [details] remove legacy includes
https://gcc.gnu.org/onlinedocs/gcc-5.3.0/cpp/System-specific-Predefined-Macros.html#System-specific-Predefined-Macros The C standard requires that all system-specific macros be part of the reserved namespace. All names which begin with two underscores, or an underscore and a capital letter, are reserved for the compiler and library to use as they wish. However, historically system-specific macros have had names with no special prefix; for instance, it is common to find unix defined on Unix systems. For all such macros, GCC provides a parallel macro with two underscores added at the beginning and the end. If unix is defined, __unix__ will be defined too. There will never be more than two underscores; the parallel of _mips is __mips__. We are slowly phasing out all predefined macros which are outside the reserved namespace. You should never use them in new programs, and we encourage you to correct older code to use the parallel macros whenever you find it. We don't recommend you use the system-specific macros that are in the reserved namespace, either. It is better in the long run to check specifically for features you need, using a tool such as autoconf.