Fix build with CFLAGS="-std=c11 -D_GNU_SOURCE"
authorTom Anderson <thomasanderson@chromium.org>
Thu, 26 Jul 2018 00:10:16 +0000 (17:10 -0700)
committerLenny Komow <lenny@lunarg.com>
Thu, 26 Jul 2018 16:25:32 +0000 (10:25 -0600)
loader/debug_utils.c
loader/extension_manual.c
loader/loader.c
loader/trampoline.c
loader/vk_loader_platform.h
loader/wsi.c
scripts/loader_extension_generator.py

index 988dd3cbe4b244eed8fe323dbb79fab3b94f9e7a..6d6c442eeacf322bf84818b865bdd96a72aa4f41 100644 (file)
@@ -22,7 +22,9 @@
  *
  */
 
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
index 2b70af709d5dda271123cd2c501a3d76dfa672fd..5a2f7151d4c0b63b8d810b191dd5690d324c657b 100644 (file)
@@ -19,7 +19,9 @@
  * Author: Lenny Komow <lenny@lunarg.com>
  */
 
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 1d8dfdf730108ab726289b4b2133ce185d94aacd..de573aecd977fc9c2562ba44cd1911e15bb77e1a 100644 (file)
@@ -25,7 +25,9 @@
  *
  */
 
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
index 212f0f559102b1efb26e4b99b8ba530caa896453..a66efcf3688f306cb9966477a9acbb336b21e2a5 100644 (file)
  * Author: Tony Barbour <tony@LunarG.com>
  * Author: Chia-I Wu <olv@lunarg.com>
  */
+
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 #include <stdlib.h>
 #include <string.h>
 
index 416256026d0adf70f90362a9d03cbc04e7d8fa73..5cbbd803bd94353476ee330213b8da5505d1fdb9 100644 (file)
@@ -35,7 +35,9 @@
 /* Linux-specific common code: */
 
 // Headers:
+//#ifndef _GNU_SOURCE
 //#define _GNU_SOURCE 1
+//#endif
 // TBD: Are the contents of the following file used?
 #include <unistd.h>
 // Note: The following file is for dynamic loading:
index 594188e96bc1e0aa8372d245fe37d5b1a10885cb..3c753d9c33628d2ab16e8bb19a16cd8ca03d8c97 100644 (file)
@@ -21,7 +21,9 @@
  * Author: Mark Lobodzinski <mark@lunarg.com>
  */
 
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 9a483b53bb025f288ddd32c646cc9a574b166838..30442c90a1e12e49abadb529c52f35d0f188758f 100644 (file)
@@ -180,7 +180,9 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
             preamble += '#pragma once\n'
 
         elif self.genOpts.filename == 'vk_loader_extensions.c':
+            preamble += '#ifndef _GNU_SOURCE\n'
             preamble += '#define _GNU_SOURCE\n'
+            preamble += '#endif\n'
             preamble += '#include <stdio.h>\n'
             preamble += '#include <stdlib.h>\n'
             preamble += '#include <string.h>\n'