OSDN Git Service

2009-05-28 Kai Tietz <kai.tietz@onevision.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / torture / pr39204.c
1 /* { dg-do compile } */
2 /* { dg-options "-w" } */
3
4 __extension__ typedef __SIZE_TYPE__ size_t;
5 typedef unsigned char __u_char;
6 typedef unsigned short int __u_short;
7 typedef unsigned int __u_int;
8 typedef unsigned long int __u_long;
9 typedef signed char __int8_t;
10 typedef unsigned char __uint8_t;
11 typedef signed short int __int16_t;
12 typedef unsigned short int __uint16_t;
13 typedef signed int __int32_t;
14 typedef unsigned int __uint32_t;
15 __extension__ typedef signed long long int __int64_t;
16 __extension__ typedef unsigned long long int __uint64_t;
17 __extension__ typedef long long int __quad_t;
18 __extension__ typedef unsigned long long int __u_quad_t;
19 __extension__ typedef __u_quad_t __dev_t;
20 __extension__ typedef unsigned int __uid_t;
21 __extension__ typedef unsigned int __gid_t;
22 __extension__ typedef unsigned long int __ino_t;
23 __extension__ typedef __u_quad_t __ino64_t;
24 __extension__ typedef unsigned int __mode_t;
25 __extension__ typedef unsigned int __nlink_t;
26 __extension__ typedef long int __off_t;
27 __extension__ typedef __quad_t __off64_t;
28 __extension__ typedef int __pid_t;
29 __extension__ typedef struct {
30     int __val[2];
31 } __fsid_t;
32 __extension__ typedef long int __clock_t;
33 __extension__ typedef unsigned int __id_t;
34 typedef struct _IO_FILE FILE;
35 typedef struct _IO_FILE __FILE;
36 typedef struct {
37     int __count;
38     union   {
39         unsigned int __wch;
40         char __wchb[4];
41     }
42     __value;
43 } __mbstate_t;
44 typedef struct {
45     __off_t __pos;
46     __mbstate_t __state;
47 } _G_fpos_t;
48 typedef struct {
49     __off64_t __pos;
50     __mbstate_t __state;
51 } _G_fpos64_t;
52 typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
53 typedef struct _IO_FILE _IO_FILE;
54 extern struct _IO_FILE_plus _IO_2_1_stderr_;
55 extern int fputs (__const char *__restrict __s, FILE * __restrict __stream);
56 extern char *strstr (__const char *__haystack, __const char *__needle)
57      __attribute__ ((__nonnull__ (1, 2)));
58      extern char *rindex (__const char *__s, int __c)   __attribute__ ((__nonnull__ (1)));
59 extern size_t strlen (__const char *__s) __attribute__ ((__nothrow__))
60      __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
61      char *mystrlwr (char *string);
62      char *m_replace_filename (const char *path, const char *filename);
63      typedef struct LINE {
64          char *text;
65          struct LINE *next;
66          int flags;
67      } LINE;
68 typedef struct TOC {
69     char *text;
70     char *alt;
71     struct TOC *next;
72     int root;
73     int texinfoable;
74     int htmlable;
75     int otherfile;
76 } TOC;
77 static int _empty_count;
78 extern char *_word_substitution[256];
79 static void _output_sorted_nested_toc (TOC ** list, unsigned int num_items);
80 static char *_do_text_substitution (char *input);
81 static int _toc_scmp (const void *e1, const void *e2)
82 {
83   TOC *t1 = *((TOC **) e1);
84   TOC *t2 = *((TOC **) e2);
85   return mystricmp (t1->text, t2->text);
86 }
87 static void _output_buffered_text (void) { if (_empty_count) ; }
88 void _post_process_filename (char *filename)
89 {
90   int code_scanning = 0;
91   char *new_filename, *p;
92   char *line;
93   FILE *f1 = 0, *f2 = 0;
94   if (!new_filename || strlen (new_filename) < 2)
95     new_filename[strlen (filename) - 1] = 'x';
96   if (!f1 || !f2)
97     while ((line = m_fgets (f1)))
98       {
99         line = _do_text_substitution (line);
100         fputs (line, f2);
101       }
102   if (remove (filename))
103     cancel:
104         if (f1)
105           if (f2)
106             if (new_filename)
107               ;
108 }
109 static void _close_html_file (FILE * file)
110 {
111   int f;
112   for (f = 0; _word_substitution[f]; f++)
113     ;
114 }
115 static __attribute__((always_inline))
116 char * _do_text_substitution (char *input)
117 {
118   int start, end, middle, f;
119   char *temp, *found, *reader;
120   for (f = 0; _word_substitution[f]; f++)
121     {
122       reader = input;
123       while ((found = strstr (reader, _word_substitution[f])))
124         {
125           start = found - input;
126           input = temp;
127           reader = temp + start + middle;
128         }
129     }
130   return input;
131 }