1 /* Copyright (C) 2000, 2003 Free Software Foundation.
3 Ensure all expected transformations of builtin strstr occur and
4 perform correctly in presence of redirect. */
6 #define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
7 #define ASMNAME2(prefix, cname) STRING (prefix) cname
10 typedef __SIZE_TYPE__
size_t;
11 extern void abort (void);
12 extern char *strstr (const char *, const char *)
13 __asm (ASMNAME ("my_strstr"));
15 const char *p
= "rld", *q
= "hello world";
20 const char *const foo
= "hello world";
22 if (strstr (foo
, "") != foo
)
24 if (strstr (foo
+ 4, "") != foo
+ 4)
26 if (strstr (foo
, "h") != foo
)
28 if (strstr (foo
, "w") != foo
+ 6)
30 if (strstr (foo
+ 6, "o") != foo
+ 7)
32 if (strstr (foo
+ 1, "world") != foo
+ 6)
34 if (strstr (foo
+ 2, p
) != foo
+ 8)
36 if (strstr (q
, "") != q
)
38 if (strstr (q
+ 1, "o") != q
+ 4)
41 /* Test at least one instance of the __builtin_ style. We do this
42 to ensure that it works and that the prototype is correct. */
43 if (__builtin_strstr (foo
+ 1, "world") != foo
+ 6)