Prechádzať zdrojové kódy

Fix illegal compile definitions for the POSIX platform

Compile definitions with two leading underscores like __USE_GNU and
__USE_XOPEN2K which are defined in /usr/include/features.h are only meant
for internal use of the <features.h> header of the GLIBC. They must not be
used by a normal user.

Replace __USE_GNU by the official _GNU_SOURCE macro meant for public use.
The __USE_XOPEN2K is already switched on by _POSIX_C_SOURCE=200112L.

This change also lets us get rid of the Linux specific header <linux/if.h>
that was used in networkconfig.c. Now including <net/if.h> suffices.

Signed-off-by: Stefan Mätje <stefan.maetje@esd.eu>
Stefan Mätje 6 rokov pred
rodič
commit
070fe49555

+ 1 - 1
source/buildsupport/POSIX/OpENer_PLATFORM_INCLUDES.cmake

@@ -7,7 +7,7 @@ macro(opener_platform_spec)
   if(NOT CMAKE_INSTALL_INCLUDEDIR )
     set( CMAKE_INSTALL_INCLUDEDIR "include")
   endif()
-  add_definitions( -D_POSIX_C_SOURCE=200112L -D__USE_GNU -D__USE_XOPEN2K -DOPENER_POSIX)
+  add_definitions( -D_POSIX_C_SOURCE=200112L -D_GNU_SOURCE -DOPENER_POSIX)
   get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
   if ("CXX" IN_LIST languages)
   	add_definitions(-DRESTRICT=)

+ 0 - 1
source/src/ports/POSIX/networkconfig.c

@@ -16,7 +16,6 @@
 
 #include <sys/ioctl.h>
 #include <sys/socket.h>
-#include <linux/if.h>
 #include <net/if.h>
 #include <netinet/in.h>