@item stpcpy
Target provides @code{stpcpy} function.
+@item strndup
+Target provides @code{strndup} function.
+
@item sysconf
Target supports @code{sysconf}.
/* { dg-do run } */
/* { dg-options "-O2" } */
/* { dg-require-effective-target size20plus } */
-/* { dg-skip-if "no strndup" { hppa*-*-hpux* } } */
+/* { dg-additional-options "-DSKIP_STRNDUP" { target { ! strndup } } } */
#include "builtin-object-size-common.h"
return sz;
}
+#ifndef SKIP_STRNDUP
size_t
__attribute__ ((noinline))
test_strndup (const char *in, size_t bound)
__builtin_free (res);
return sz;
}
+#endif
size_t
__attribute__ ((noinline))
return sz;
}
+#ifndef SKIP_STRNDUP
size_t
__attribute__ ((noinline))
test_strndup_min (const char *in, size_t bound)
__builtin_free (res);
return sz;
}
+#endif
/* Other tests. */
const char *str = "hello world";
if (test_strdup (str) != __builtin_strlen (str) + 1)
FAIL ();
+#ifndef SKIP_STRNDUP
if (test_strndup (str, 4) != 5)
FAIL ();
+#endif
if (test_strdup_min (str) != __builtin_strlen (str) + 1)
FAIL ();
+#ifndef SKIP_STRNDUP
if (test_strndup_min (str, 4) != 1)
FAIL ();
+#endif
DONE ();
}
/* { dg-do run } */
/* { dg-options "-O2 -Wno-stringop-overread" } */
/* { dg-require-effective-target alloca } */
-/* { dg-skip-if "no strndup" { hppa*-*-hpux* } } */
+/* { dg-additional-options "-DSKIP_STRNDUP" { target { ! strndup } } } */
#define __builtin_object_size __builtin_dynamic_object_size
#include "builtin-object-size-1.c"
/* { dg-do run } */
/* { dg-options "-O2 -Wno-stringop-overread" } */
/* { dg-require-effective-target alloca } */
-/* { dg-skip-if "no strndup" { hppa*-*-hpux* } } */
+/* { dg-additional-options "-DSKIP_STRNDUP" { target { ! strndup } } } */
#define __builtin_object_size __builtin_dynamic_object_size
#include "builtin-object-size-2.c"
/* { dg-do run } */
/* { dg-options "-O2 -Wno-stringop-overread" } */
/* { dg-require-effective-target alloca } */
-/* { dg-skip-if "no strndup" { hppa*-*-hpux* } } */
+/* { dg-additional-options "-DSKIP_STRNDUP" { target { ! strndup } } } */
#define __builtin_object_size __builtin_dynamic_object_size
#include "builtin-object-size-3.c"
/* { dg-do run } */
/* { dg-options "-O2 -Wno-stringop-overread" } */
/* { dg-require-effective-target alloca } */
-/* { dg-skip-if "no strndup" { hppa*-*-hpux* } } */
+/* { dg-additional-options "-DSKIP_STRNDUP" { target { ! strndup } } } */
#define __builtin_object_size __builtin_dynamic_object_size
#include "builtin-object-size-4.c"
/* { dg-do run } */
/* { dg-options "-O2 -Wno-stringop-overread" } */
/* { dg-require-effective-target alloca } */
+/* { dg-additional-options "-DSKIP_STRNDUP" { target { ! strndup } } } */
#include "builtin-object-size-common.h"
}
}
-#if !defined(__AVR__) && !defined(__hpux__) /* avr and hpux have no strndup */
+#ifndef SKIP_STRNDUP
/* Tests for strdup/strndup. */
size_t
__attribute__ ((noinline))
FAIL ();
free (res);
}
-#endif /* avr */
+#endif
int
main (void)
test8 ();
test9 (1);
test10 ();
-#if !defined(__AVR__) && !defined(__hpux__) /* avr and hpux have no strndup */
+#ifndef SKIP_STRNDUP
test11 ();
#endif
DONE ();
/* { dg-do run } */
/* { dg-options "-O2 -Wno-stringop-overread" } */
/* { dg-require-effective-target alloca } */
+/* { dg-additional-options "-DSKIP_STRNDUP" { target { ! strndup } } } */
#include "builtin-object-size-common.h"
#endif
}
-#if !defined(__AVR__) && !defined(__hpux__) /* avr and hpux have no strndup */
+#ifndef SKIP_STRNDUP
/* Tests for strdup/strndup. */
size_t
__attribute__ ((noinline))
FAIL ();
free (res);
}
-#endif /* avr */
+#endif
int
main (void)
test6 ();
test7 ();
test8 (1);
-#if !defined(__AVR__) && !defined(__hpux__) /* avr and hpux have no strndup */
+#ifndef SKIP_STRNDUP
test9 ();
#endif
DONE ();
/* { dg-do run } */
/* { dg-options "-O2 -Wno-stringop-overread" } */
/* { dg-require-effective-target alloca } */
+/* { dg-additional-options "-DSKIP_STRNDUP" { target { ! strndup } } } */
#include "builtin-object-size-common.h"
}
}
-#if !defined(__AVR__) && !defined(__hpux__) /* avr and hpux have no strndup */
+#ifndef SKIP_STRNDUP
/* Tests for strdup/strndup. */
size_t
__attribute__ ((noinline))
FAIL ();
free (res);
}
-#endif /* avr */
+#endif
int
main (void)
test8 ();
test9 (1);
test10 ();
-#if !defined(__AVR__) && !defined(__hpux__) /* avr and hpux have no strndup */
+#ifndef SKIP_STRNDUP
test11 ();
#endif
DONE ();
/* { dg-do run } */
/* { dg-options "-O2 -Wno-stringop-overread" } */
/* { dg-require-effective-target alloca } */
+/* { dg-additional-options "-DSKIP_STRNDUP" { target { ! strndup } } } */
#include "builtin-object-size-common.h"
#endif
}
-#if !defined(__AVR__) && !defined(__hpux__) /* avr and hpux have no strndup */
+#ifndef SKIP_STRNDUP
/* Tests for strdup/strndup. */
size_t
__attribute__ ((noinline))
FAIL ();
free (res);
}
-#endif /* avr */
+#endif
int
main (void)
test6 ();
test7 ();
test8 (1);
-#if !defined(__AVR__) && !defined(__hpux__) /* avr and hpux have no strndup */
+#ifndef SKIP_STRNDUP
test9 ();
#endif
DONE ();
return [check_function_available "stpcpy"]
}
+# Returns 1 if "strndup" is available on the target system.
+
+proc check_effective_target_strndup {} {
+ if { [istarget *-*-vxworks*] } {
+ # VxWorks doesn't have strndup but our way to test fails
+ # to detect as we're doing partial links for kernel modules.
+ return 0
+ }
+ return [check_function_available "strndup"]
+}
+
# Returns 1 if "sigsetjmp" is available on the target system.
# Also check if "__sigsetjmp" is defined since that's what glibc
# uses.