Request X/Open 7 rather than declaring strdup ourselves.
authorFlorian Forster <octo@leeloo.octo.it>
Mon, 22 Nov 2010 09:18:45 +0000 (10:18 +0100)
committerFlorian Forster <octo@leeloo.octo.it>
Mon, 22 Nov 2010 09:18:45 +0000 (10:18 +0100)
src/pop_stats.c
src/sn-evolution.c
src/sn-evolution2.c

index 7a13c82..7f799f8 100644 (file)
  *   Florian octo Forster <ff at octo.it>
  **/
 
  *   Florian octo Forster <ff at octo.it>
  **/
 
+#ifndef _ISOC99_SOURCE
+# define _ISOC99_SOURCE
+#endif
+#ifndef _POSIX_C_SOURCE
+# define _POSIX_C_SOURCE 200809L
+#endif
+#ifndef _XOPEN_SOURCE
+# define _XOPEN_SOURCE 700
+#endif
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdint.h>
 
 #include "pop_stats.h"
 
 
 #include "pop_stats.h"
 
-/* Yes, this is ugly, but the GNU libc doesn't export it with the above flags.
- * */
-char *strdup (const char *s);
-
 struct pop_stats_s /* {{{ */
 {
   pthread_mutex_t lock;
 struct pop_stats_s /* {{{ */
 {
   pthread_mutex_t lock;
index 71f0c67..8774f4a 100644 (file)
 # define _ISOC99_SOURCE
 #endif
 #ifndef _POSIX_C_SOURCE
 # define _ISOC99_SOURCE
 #endif
 #ifndef _POSIX_C_SOURCE
-# define _POSIX_C_SOURCE 200112L
+# define _POSIX_C_SOURCE 200809L
+#endif
+#ifndef _XOPEN_SOURCE
+# define _XOPEN_SOURCE 700
 #endif
 
 #include <stdlib.h>
 #endif
 
 #include <stdlib.h>
 # define __attribute__(x) /**/
 #endif
 
 # define __attribute__(x) /**/
 #endif
 
-/* Yes, this is ugly, but the GNU libc doesn't export it with the above flags.
- * */
-char *strdup (const char *s);
-
 static uint64_t iteration_counter = 0;
 static int inputs_num = 16;
 static int inputs_num_is_power_of_two = 1;
 static uint64_t iteration_counter = 0;
 static int inputs_num = 16;
 static int inputs_num_is_power_of_two = 1;
index c18c30d..2f894ec 100644 (file)
 # define _ISOC99_SOURCE
 #endif
 #ifndef _POSIX_C_SOURCE
 # define _ISOC99_SOURCE
 #endif
 #ifndef _POSIX_C_SOURCE
-# define _POSIX_C_SOURCE 200112L
+# define _POSIX_C_SOURCE 200809L
+#endif
+#ifndef _XOPEN_SOURCE
+# define _XOPEN_SOURCE 700
 #endif
 
 #include <stdlib.h>
 #endif
 
 #include <stdlib.h>
 #include "sn_network.h"
 #include "sn_random.h"
 
 #include "sn_network.h"
 #include "sn_random.h"
 
+#if !defined(__GNUC__) || !__GNUC__
+# define __attribute__(x) /**/
+#endif
+
 #define SNE_MIN(a,b) ((a) < (b) ? (a) : (b))
 #define SNE_MAX(a,b) ((a) > (b) ? (a) : (b))
 
 #define SNE_MIN(a,b) ((a) < (b) ? (a) : (b))
 #define SNE_MAX(a,b) ((a) > (b) ? (a) : (b))
 
-/* Yes, this is ugly, but the GNU libc doesn't export it with the above flags.
- * */
-char *strdup (const char *s);
-
 static uint64_t iteration_counter = 0;
 static int inputs_num = -1;
 
 static uint64_t iteration_counter = 0;
 static int inputs_num = -1;
 
@@ -76,7 +79,7 @@ static int weight_overall = 50;
 static int weight_fails = 2;
 static int weight_stages = 1;
 
 static int weight_fails = 2;
 static int weight_stages = 1;
 
-static void sigint_handler (int signal)
+static void sigint_handler (__attribute__((unused)) int signal)
 {
   do_loop++;
 } /* void sigint_handler */
 {
   do_loop++;
 } /* void sigint_handler */
@@ -394,7 +397,7 @@ static int create_offspring (void)
   return (0);
 } /* int create_offspring */
 
   return (0);
 } /* int create_offspring */
 
-static void *evolution_thread (void *arg)
+static void *evolution_thread (__attribute__((unused)) void *arg)
 {
   while (do_loop == 0)
   {
 {
   while (do_loop == 0)
   {