1/* { dg-options "-fno-short-enums" } */
2enum
3{
4  _sch_isdigit = 0x0004,
5  _sch_ispunct = 0x0020,
6  _sch_isxdigit = 0x0100,
7  _sch_isidst = 0x0200,
8  _sch_isvsp = 0x0400,
9  _sch_isnvsp = 0x0800,
10  _sch_isalnum = _sch_isidst | _sch_isdigit,
11  _sch_iscppsp = _sch_isvsp | _sch_isnvsp,
12};
13extern const unsigned short _sch_istable[256];
14typedef union tree_node *tree;
15typedef const union tree_node *const_tree;
16enum opt_code
17{
18  OPT_Warray_bounds = 240,
19  OPT_Wformat_ = 245,
20  OPT_Wintf_annotation = 368,
21  OPT_std_gnu__14 = 1311,
22};
23enum tree_code
24{
25  TREE_LIST,
26  CONST_DECL,
27  ADDR_EXPR,
28  MAX_TREE_CODES
29};
30enum tree_code_class
31{
32  tcc_type,
33};
34enum tree_node_structure_enum
35{
36  TS_TYPED,
37  TS_COMMON,
38};
39enum integer_type_kind
40{
41  itk_char,
42  itk_none
43};
44struct tree_base
45{
46  enum tree_code code:16;
47};
48struct tree_typed
49{
50  tree type;
51};
52struct tree_common
53{
54  tree chain;
55};
56struct tree_list
57{
58  tree purpose;
59};
60struct tree_type_common
61{
62  tree main_variant;
63};
64union tree_node
65{
66  struct tree_base base;
67  struct tree_typed typed;
68  struct tree_common common;
69  struct tree_type_common type_common;
70  struct tree_list list;
71};
72extern unsigned char tree_contains_struct[MAX_TREE_CODES][64];
73extern tree integer_types[itk_none];
74extern void tree_contains_struct_check_failed (const_tree,
75					       tree_node_structure_enum,
76					       const char *, int,
77					       const char *)
78  __attribute__ ((__noreturn__));
79inline tree
80tree_check (tree __t, const char *__f, int __l, const char *__g,
81	    tree_code __c)
82{
83}
84
85inline const_tree
86contains_struct_check (const_tree __t,
87		       const enum tree_node_structure_enum __s,
88		       const char *__f, int __l, const char *__g)
89{
90  if (tree_contains_struct[((enum tree_code) (__t)->base.code)][__s] != 1)
91    tree_contains_struct_check_failed (__t, __s, __f, __l, __g);
92}
93
94inline const_tree
95tree_class_check (const_tree __t, const enum tree_code_class __class,
96		  const char *__f, int __l, const char *__g)
97{
98}
99
100static inline bool
101is_attribute_p (const char *attr_name, const_tree ident)
102{
103}
104
105extern int integer_zerop (const_tree);
106extern bool warning (int, const char *, ...)
107  __attribute__ ((__nonnull__ (2)));
108extern void
109check_function_arguments_recurse (void (*)(void *, tree, unsigned long long),
110				  void *, tree, unsigned long long);
111extern bool objc_string_ref_type_p (tree);
112enum
113{
114  FMT_FLAG_SCANF_A_KLUDGE = 2,
115  FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL = 256
116};
117typedef struct
118{
119}
120format_flag_spec;
121typedef struct
122{
123  int flags;
124  tree *width_type;
125}
126format_kind_info;
127typedef struct alloc_pool_list_def
128{
129}
130 *alloc_pool;
131struct gcc_targetcm
132{
133  bool (*string_object_ref_type_p) (const_tree stringref);
134}
135 ;
136extern struct gcc_targetcm targetcm;
137enum format_type
138{
139  gcc_objc_string_format_type,
140};
141typedef struct function_format_info
142{
143  int format_type;
144}
145function_format_info;
146static const format_kind_info format_types_orig[] = { };
147struct format_check_context { };
148
149static const format_kind_info *format_types = format_types_orig;
150static void check_format_info (function_format_info *, tree);
151void check_format_arg (void *, tree, unsigned long long);
152
153void
154check_function_format (tree attrs, int nargs, tree * argarray)
155{
156  tree a;
157  for (a = attrs;
158       a;
159       ((contains_struct_check
160	 ((a), (TS_COMMON), "../../git-master/gcc/c-family/c-format.c", 1002,
161	  __FUNCTION__))->common.chain))
162    {
163      if (is_attribute_p
164	  ("format",
165	   ((tree_check
166	     ((a), "../../git-master/gcc/c-family/c-format.c", 1004,
167	      __FUNCTION__, (TREE_LIST)))->list.purpose)))
168	{
169	  function_format_info info;
170	  {
171	    tree params = (tree) __null;
172	    check_format_info (&info, params);
173	  }
174	}
175    }
176}
177
178static bool
179avoid_dollar_number (const char *format)
180{
181  while ((_sch_istable[(*format) & 0xff] & (unsigned short) (_sch_isdigit)))
182    format++;
183  if (*format == '$')
184    {
185      warning (OPT_Wformat_,
186	       "$ operand number used after format without operand number");
187    }
188}
189
190static void
191check_format_info (function_format_info * info, tree params)
192{
193  format_check_context format_ctx;
194  unsigned long long arg_num;
195  tree format_tree;
196  check_function_arguments_recurse (check_format_arg, &format_ctx,
197				    format_tree, arg_num);
198  const char *format_chars;
199  if (integer_zerop (format_tree))
200    {
201      {
202	((contains_struct_check
203	  ((params), (TS_COMMON),
204	   "../../git-master/gcc/c-family/c-format.c", 1444,
205	   __FUNCTION__))->common.chain);
206      }
207      return;
208    }
209  if (((enum tree_code) (format_tree)->base.code) != ADDR_EXPR)
210    {
211      return;
212    }
213  if (format_types[info->format_type].flags & (int)
214      FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL)
215    {
216      bool objc_str = (info->format_type == gcc_objc_string_format_type);
217      if (((enum tree_code) (format_tree)->base.code) != CONST_DECL
218	  ||
219	  !((objc_str
220	     &&
221	     objc_string_ref_type_p (((contains_struct_check
222				       ((format_tree), (TS_TYPED),
223					"../../git-master/gcc/c-family/c-format.c",
224					1498, __FUNCTION__))->typed.type)))
225	    ||
226	    (*targetcm.string_object_ref_type_p) ((const_tree)
227						  ((contains_struct_check
228						    ((format_tree),
229						     (TS_TYPED),
230						     "../../git-master/gcc/c-family/c-format.c",
231						     1500,
232						     __FUNCTION__))->typed.
233						   type))))
234	{
235	}
236    }
237  {
238  }
239  if (((tree_class_check
240	((((contains_struct_check
241	    ((((contains_struct_check
242		((format_tree), (TS_TYPED),
243		 "../../git-master/gcc/c-family/c-format.c", 1549,
244		 __FUNCTION__))->typed.type)), (TS_TYPED),
245	     "../../git-master/gcc/c-family/c-format.c", 1549,
246	     __FUNCTION__))->typed.type)), (tcc_type),
247	 "../../git-master/gcc/c-family/c-format.c", 1549,
248	 __FUNCTION__))->type_common.main_variant) != integer_types[itk_char])
249    {
250      return;
251    }
252  {
253  }
254  const format_kind_info *fki = &format_types[info->format_type];
255  while (*format_chars != 0)
256    {
257      {
258	if (fki->width_type != __null && *format_chars == '*')
259	  {
260	    {
261	      if (avoid_dollar_number (format_chars))
262		if (avoid_dollar_number (format_chars))
263		  return;
264	    }
265	  }
266      }
267    }
268}
269