OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [builtins/] [strpbrk.c] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Copyright (C) 2000  Free Software Foundation.
2
 
3
   Ensure all expected transformations of builtin strpbrk occur and
4
   perform correctly.
5
 
6
   Written by Kaveh R. Ghazi, 11/6/2000.  */
7
 
8
extern void abort(void);
9
extern char *strpbrk (const char *, const char *);
10
extern int strcmp (const char *, const char *);
11
 
12
void fn (const char *foo, const char *const *bar)
13
{
14
  if (strcmp(strpbrk ("hello world", "lrooo"), "llo world") != 0)
15
    abort();
16
  if (strpbrk (foo, "") != 0)
17
    abort();
18
  if (strpbrk (foo + 4, "") != 0)
19
    abort();
20
  if (strpbrk (*bar--, "") != 0)
21
    abort();
22
  if (strpbrk (*bar, "h") != foo)
23
    abort();
24
  if (strpbrk (foo, "h") != foo)
25
    abort();
26
  if (strpbrk (foo, "w") != foo + 6)
27
    abort();
28
  if (strpbrk (foo + 6, "o") != foo + 7)
29
    abort();
30
 
31
  /* Test at least one instance of the __builtin_ style.  We do this
32
     to ensure that it works and that the prototype is correct.  */
33
  if (__builtin_strpbrk (foo + 6, "o") != foo + 7)
34
    abort();
35
}
36
 
37
void
38
main_test (void)
39
{
40
  const char *const foo[] = { "hello world", "bye bye world" };
41
  fn (foo[0], foo + 1);
42
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.