Пример #1
0
void
main_test (void)
{
  const char *const foo = "hello world";

  if (strstr (foo, "") != foo)
    abort ();
  if (strstr (foo + 4, "") != foo + 4)
    abort ();
  if (strstr (foo, "h") != foo)
    abort ();
  if (strstr (foo, "w") != foo + 6)
    abort ();
  if (strstr (foo + 6, "o") != foo + 7)
    abort ();
  if (strstr (foo + 1, "world") != foo + 6)
    abort ();
  if (strstr (foo + 2, p) != foo + 8)
    abort ();
  if (strstr (q, "") != q)
    abort ();
  if (strstr (q + 1, "o") != q + 4)
    abort ();



  if (__builtin_strstr (foo + 1, "world") != foo + 6)
    abort ();
}
Пример #2
0
void f5(char *s)
{
  char *t1 = __builtin_strstr (s, "hello");
  void foo_f5(void);
  if (t1 != s)
    foo_f5();
}
Пример #3
0
void
c (void)
{
  __builtin_strcat (d, "12345");
  if (__builtin_strstr (b, d) == b)
    a ();
}
Пример #4
0
_Bool f7(char *s)
{
  void foo_f7(char *);

  char *t1 = __builtin_strstr (s, "hello");
  foo_f7 (t1);
  return (t1 == s);
}
Пример #5
0
_Bool f4()
{
  char *foo_f4(void);
  char *t1 = foo_f4();
  char *t2 = __builtin_strstr (t1, "hello");
  _Bool t3 = t2 == t1;
  return t3;
}
Пример #6
0
void
foo (void)
{
  const char *p = "abcdef";
  const char *q = "def";
  p++;
  q++;
  if (__builtin_strstr (p, q) != p + 3)
    link_error ();
}
Пример #7
0
void
foo (struct A *p)
{
  char s[4096];
  const char *u = p->a;
  const char *t;
  while ((t = __builtin_strstr (u, "gcc/")))
    u = t + 4;

  /* Verfiy the following doesn't emit a warning.  */
  __builtin_sprintf (s, "%s:%i (%s)", u, p->b, p->c);
  bar (s);
}
Пример #8
0
void
main_test (void)
{
  const char *const foo = "hello world";
  
  if (strstr (foo, "") != foo)
    abort();
  if (strstr (foo + 4, "") != foo + 4)
    abort();
  if (strstr (foo, "h") != foo)
    abort();
  if (strstr (foo, "w") != foo + 6)
    abort();
  if (strstr (foo + 6, "o") != foo + 7)
    abort();
  if (strstr (foo + 1, "world") != foo + 6)
    abort();

  /* Test at least one instance of the __builtin_ style.  We do this
     to ensure that it works and that the prototype is correct.  */
  if (__builtin_strstr (foo + 1, "world") != foo + 6)
    abort();
}
// CHECK: call i8* @strstr{{.*}} nounwind
char* f2(char* a, char* b) {
  return __builtin_strstr(a, b);
}
Пример #10
0
_Bool f6(char *s, char *t)
{
  return __builtin_strstr (s, t) == s;
}
Пример #11
0
_Bool f1(char *s)
{
  return __builtin_strstr (s, "hello") == s;
}
Пример #12
0
_Bool f3(char *s)
{
  return s != __builtin_strstr (s, "hello");
}
Пример #13
0
_Bool f2(char *s)
{
  return s == __builtin_strstr (s, "hello");
}
Пример #14
0
char *
baz (const char *p)
{
  return __builtin_strstr (p, "d");
}
Пример #15
0
char *
bar (const char *p)
{
  return __builtin_strstr (p, "");
}