Browse Source

argp: be sure uClibc-ng feature is available

Waldemar Brodkorb 7 years ago
parent
commit
24b4b8b663

+ 6 - 0
test/argp/argp-ex1.c

@@ -6,10 +6,16 @@
    a (rather pointless) messages for --help.  */
 
 #include <stdlib.h>
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
 #include <argp.h>
+#endif
 
 int main (int argc, char **argv)
 {
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
   argp_parse (0, argc, argv, 0, 0, 0);
   exit (0);
+#else
+  return 23;
+#endif
 }

+ 6 - 0
test/argp/argp-ex2.c

@@ -20,6 +20,7 @@
    parsers for various tasks).  */
 
 #include <stdlib.h>
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
 #include <argp.h>
 
 const char *argp_program_version =
@@ -37,9 +38,14 @@ static char doc[] =
    used in the output for @samp{--help}, and the @samp{--version}
    option will print out @code{argp_program_version}.  */
 static struct argp argp = { 0, 0, 0, doc };
+#endif
 
 int main (int argc, char **argv)
 {
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
   argp_parse (&argp, argc, argv, 0, 0, 0);
   exit (0);
+#else
+  return 23;
+#endif
 }

+ 7 - 0
test/argp/argp-ex3.c

@@ -53,6 +53,7 @@
    An options vector should be terminated by an option with all fields zero. */
 
 #include <stdlib.h>
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
 #include <argp.h>
 
 const char *argp_program_version =
@@ -129,8 +130,11 @@ parse_opt (int key, char *arg, struct argp_state *state)
 /* Our argp parser.  */
 static struct argp argp = { options, parse_opt, args_doc, doc };
 
+#endif
+
 int main (int argc, char **argv)
 {
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
   struct arguments arguments;
 
   /* Default values.  */
@@ -150,4 +154,7 @@ int main (int argc, char **argv)
          arguments.silent ? "yes" : "no");
 
   exit (0);
+#else
+  return 23;
+#endif
 }

+ 6 - 0
test/argp/argp-ex4.c

@@ -25,6 +25,7 @@
 
 #include <stdlib.h>
 #include <error.h>
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
 #include <argp.h>
 
 const char *argp_program_version =
@@ -130,9 +131,11 @@ parse_opt (int key, char *arg, struct argp_state *state)
 
 /* Our argp parser.  */
 static struct argp argp = { options, parse_opt, args_doc, doc };
+#endif
 
 int main (int argc, char **argv)
 {
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
   int i, j;
   struct arguments arguments;
 
@@ -164,4 +167,7 @@ int main (int argc, char **argv)
     }
 
   exit (0);
+#else
+  return 23;
+#endif
 }

+ 6 - 0
test/argp/argp-test.c

@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <time.h>
 #include <string.h>
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
 #include <argp.h>
 
 const char *argp_program_version = "argp-test 1.0";
@@ -195,14 +196,19 @@ static struct argp_child argp_children[] = { { &sub_argp }, { 0 } };
 static struct argp argp = {
   options, parse_opt, args_doc, doc, argp_children, help_filter
 };
+#endif
 
 int
 main (int argc, char **argv)
 {
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
   struct params params;
   params.foonly = 0;
   params.foonly_default = random ();
   argp_parse (&argp, argc, argv, 0, 0, &params);
   printf ("After parsing: foonly = %x\n", params.foonly);
   return 0;
+#else
+  return 23;
+#endif
 }

+ 6 - 1
test/argp/bug-argp1.c

@@ -1,6 +1,6 @@
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
 #include <argp.h>
 
-
 static const struct argp_option test_options[] =
 {
   { NULL, 'a', NULL, OPTION_DOC, NULL },
@@ -13,13 +13,18 @@ static struct argp test_argp =
   test_options
 };
 
+#endif
 
 static int
 do_test (int argc, char *argv[])
 {
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
   int i;
   argp_parse (&test_argp, argc, argv, 0, &i, NULL);
   return 0;
+#else
+  return 23;
+#endif
 }
 
 #define TEST_FUNCTION do_test (argc, argv)

+ 8 - 4
test/argp/tst-argp1.c

@@ -16,11 +16,9 @@
    License along with the GNU C Library; see the file COPYING.LIB.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
 #include <argp.h>
 
-
-
-
 #define OPT_TO_THREAD          300
 #define OPT_TO_PROCESS         301
 #define OPT_SYNC_SIGNAL                302
@@ -90,11 +88,12 @@ static struct argp argp =
 {
   test_options, parse_opt
 };
-
+#endif
 
 static int
 do_test (void)
 {
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
   int argc = 2;
   char *argv[3] = { (char *) "tst-argp1", (char *) "--help", NULL };
   int remaining;
@@ -103,15 +102,20 @@ do_test (void)
   argp_parse (&argp, argc, argv, 0, &remaining, NULL);
 
   return 0;
+#else
+  return 23;
+#endif
 }
 
 
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
 /* Handle program arguments.  */
 static error_t
 parse_opt (int key, char *arg, struct argp_state *state)
 {
   return ARGP_ERR_UNKNOWN;
 }
+#endif
 
 #define TEST_FUNCTION do_test ()
 #include "../test-skeleton.c"

+ 6 - 0
test/argp/tst-argp2.c

@@ -16,6 +16,7 @@
    License along with the GNU C Library; see the file COPYING.LIB.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
 #include <argp.h>
 
 static const struct argp_option opt1[] =
@@ -87,12 +88,17 @@ static struct argp argp1 =
     opt1, NULL, "args doc1", "doc1", children1, NULL, NULL
   };
 
+#endif
 
 static int
 do_test (void)
 {
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__)
   argp_help (&argp1, stdout, ARGP_HELP_LONG, (char *) "tst-argp2");
   return 0;
+#else
+  return 23;
+#endif
 }
 
 

+ 1 - 1
test/math/libm-test.inc

@@ -118,7 +118,7 @@
 #include <complex.h>
 #include <math.h>
 #include <float.h>
-#if defined(__GLIBC__) || defined(__UCLIBC__) && defined(__UCLIBC_HAS_FENV__)
+#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_FENV__)
 #include <fenv.h>
 #else
 #include "fenv.h"