comparison libcpp/macro.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* Part of CPP library. (Macro and #define handling.) 1 /* Part of CPP library. (Macro and #define handling.)
2 Copyright (C) 1986-2018 Free Software Foundation, Inc. 2 Copyright (C) 1986-2020 Free Software Foundation, Inc.
3 Written by Per Bothner, 1994. 3 Written by Per Bothner, 1994.
4 Based on CCCP program by Paul Rubin, June 1986 4 Based on CCCP program by Paul Rubin, June 1986
5 Adapted to ANSI C, Richard Stallman, Jan 1987 5 Adapted to ANSI C, Richard Stallman, Jan 1987
6 6
7 This program is free software; you can redistribute it and/or modify it 7 This program is free software; you can redistribute it and/or modify it
37 const cpp_token **first; /* First token in unexpanded argument. */ 37 const cpp_token **first; /* First token in unexpanded argument. */
38 const cpp_token **expanded; /* Macro-expanded argument. */ 38 const cpp_token **expanded; /* Macro-expanded argument. */
39 const cpp_token *stringified; /* Stringified argument. */ 39 const cpp_token *stringified; /* Stringified argument. */
40 unsigned int count; /* # of tokens in argument. */ 40 unsigned int count; /* # of tokens in argument. */
41 unsigned int expanded_count; /* # of tokens in expanded argument. */ 41 unsigned int expanded_count; /* # of tokens in expanded argument. */
42 source_location *virt_locs; /* Where virtual locations for 42 location_t *virt_locs; /* Where virtual locations for
43 unexpanded tokens are stored. */ 43 unexpanded tokens are stored. */
44 source_location *expanded_virt_locs; /* Where virtual locations for 44 location_t *expanded_virt_locs; /* Where virtual locations for
45 expanded tokens are 45 expanded tokens are
46 stored. */ 46 stored. */
47 }; 47 };
48 48
49 /* The kind of macro tokens which the instance of 49 /* The kind of macro tokens which the instance of
70 /* A pointer to the current token pointed to by the iterator. */ 70 /* A pointer to the current token pointed to by the iterator. */
71 const cpp_token **token_ptr; 71 const cpp_token **token_ptr;
72 /* A pointer to the "full" location of the current token. If 72 /* A pointer to the "full" location of the current token. If
73 -ftrack-macro-expansion is used this location tracks loci across 73 -ftrack-macro-expansion is used this location tracks loci across
74 macro expansion. */ 74 macro expansion. */
75 const source_location *location_ptr; 75 const location_t *location_ptr;
76 #if CHECKING_P 76 #if CHECKING_P
77 /* The number of times the iterator went forward. This useful only 77 /* The number of times the iterator went forward. This useful only
78 when checking is enabled. */ 78 when checking is enabled. */
79 size_t num_forwards; 79 size_t num_forwards;
80 #endif 80 #endif
233 2 means "(" seen (so the next token can't be "##") 233 2 means "(" seen (so the next token can't be "##")
234 >= 3 means looking for ")", the number encodes the paren depth. */ 234 >= 3 means looking for ")", the number encodes the paren depth. */
235 int m_state; 235 int m_state;
236 236
237 /* The location of the paste token. */ 237 /* The location of the paste token. */
238 source_location m_paste_location; 238 location_t m_paste_location;
239 239
240 /* Location of the __VA_OPT__ token. */ 240 /* Location of the __VA_OPT__ token. */
241 source_location m_location; 241 location_t m_location;
242 }; 242 };
243 243
244 /* Macro expansion. */ 244 /* Macro expansion. */
245 245
246 static int enter_macro_context (cpp_reader *, cpp_hashnode *, 246 static int enter_macro_context (cpp_reader *, cpp_hashnode *,
247 const cpp_token *, source_location); 247 const cpp_token *, location_t);
248 static int builtin_macro (cpp_reader *, cpp_hashnode *, 248 static int builtin_macro (cpp_reader *, cpp_hashnode *,
249 source_location, source_location); 249 location_t, location_t);
250 static void push_ptoken_context (cpp_reader *, cpp_hashnode *, _cpp_buff *, 250 static void push_ptoken_context (cpp_reader *, cpp_hashnode *, _cpp_buff *,
251 const cpp_token **, unsigned int); 251 const cpp_token **, unsigned int);
252 static void push_extended_tokens_context (cpp_reader *, cpp_hashnode *, 252 static void push_extended_tokens_context (cpp_reader *, cpp_hashnode *,
253 _cpp_buff *, source_location *, 253 _cpp_buff *, location_t *,
254 const cpp_token **, unsigned int); 254 const cpp_token **, unsigned int);
255 static _cpp_buff *collect_args (cpp_reader *, const cpp_hashnode *, 255 static _cpp_buff *collect_args (cpp_reader *, const cpp_hashnode *,
256 _cpp_buff **, unsigned *); 256 _cpp_buff **, unsigned *);
257 static cpp_context *next_context (cpp_reader *); 257 static cpp_context *next_context (cpp_reader *);
258 static const cpp_token *padding_token (cpp_reader *, const cpp_token *); 258 static const cpp_token *padding_token (cpp_reader *, const cpp_token *);
259 static void expand_arg (cpp_reader *, macro_arg *); 259 static void expand_arg (cpp_reader *, macro_arg *);
260 static const cpp_token *new_string_token (cpp_reader *, uchar *, unsigned int); 260 static const cpp_token *new_string_token (cpp_reader *, uchar *, unsigned int);
261 static const cpp_token *stringify_arg (cpp_reader *, macro_arg *); 261 static const cpp_token *stringify_arg (cpp_reader *, macro_arg *);
262 static void paste_all_tokens (cpp_reader *, const cpp_token *); 262 static void paste_all_tokens (cpp_reader *, const cpp_token *);
263 static bool paste_tokens (cpp_reader *, source_location, 263 static bool paste_tokens (cpp_reader *, location_t,
264 const cpp_token **, const cpp_token *); 264 const cpp_token **, const cpp_token *);
265 static void alloc_expanded_arg_mem (cpp_reader *, macro_arg *, size_t); 265 static void alloc_expanded_arg_mem (cpp_reader *, macro_arg *, size_t);
266 static void ensure_expanded_arg_room (cpp_reader *, macro_arg *, size_t, size_t *); 266 static void ensure_expanded_arg_room (cpp_reader *, macro_arg *, size_t, size_t *);
267 static void delete_macro_args (_cpp_buff*, unsigned num_args); 267 static void delete_macro_args (_cpp_buff*, unsigned num_args);
268 static void set_arg_token (macro_arg *, const cpp_token *, 268 static void set_arg_token (macro_arg *, const cpp_token *,
269 source_location, size_t, 269 location_t, size_t,
270 enum macro_arg_token_kind, 270 enum macro_arg_token_kind,
271 bool); 271 bool);
272 static const source_location *get_arg_token_location (const macro_arg *, 272 static const location_t *get_arg_token_location (const macro_arg *,
273 enum macro_arg_token_kind); 273 enum macro_arg_token_kind);
274 static const cpp_token **arg_token_ptr_at (const macro_arg *, 274 static const cpp_token **arg_token_ptr_at (const macro_arg *,
275 size_t, 275 size_t,
276 enum macro_arg_token_kind, 276 enum macro_arg_token_kind,
277 source_location **virt_location); 277 location_t **virt_location);
278 278
279 static void macro_arg_token_iter_init (macro_arg_token_iter *, bool, 279 static void macro_arg_token_iter_init (macro_arg_token_iter *, bool,
280 enum macro_arg_token_kind, 280 enum macro_arg_token_kind,
281 const macro_arg *, 281 const macro_arg *,
282 const cpp_token **); 282 const cpp_token **);
283 static const cpp_token *macro_arg_token_iter_get_token 283 static const cpp_token *macro_arg_token_iter_get_token
284 (const macro_arg_token_iter *it); 284 (const macro_arg_token_iter *it);
285 static source_location macro_arg_token_iter_get_location 285 static location_t macro_arg_token_iter_get_location
286 (const macro_arg_token_iter *); 286 (const macro_arg_token_iter *);
287 static void macro_arg_token_iter_forward (macro_arg_token_iter *); 287 static void macro_arg_token_iter_forward (macro_arg_token_iter *);
288 static _cpp_buff *tokens_buff_new (cpp_reader *, size_t, 288 static _cpp_buff *tokens_buff_new (cpp_reader *, size_t,
289 source_location **); 289 location_t **);
290 static size_t tokens_buff_count (_cpp_buff *); 290 static size_t tokens_buff_count (_cpp_buff *);
291 static const cpp_token **tokens_buff_last_token_ptr (_cpp_buff *); 291 static const cpp_token **tokens_buff_last_token_ptr (_cpp_buff *);
292 static inline const cpp_token **tokens_buff_put_token_to (const cpp_token **, 292 static inline const cpp_token **tokens_buff_put_token_to (const cpp_token **,
293 source_location *, 293 location_t *,
294 const cpp_token *, 294 const cpp_token *,
295 source_location, 295 location_t,
296 source_location, 296 location_t,
297 const line_map_macro *, 297 const line_map_macro *,
298 unsigned int); 298 unsigned int);
299 299
300 static const cpp_token **tokens_buff_add_token (_cpp_buff *, 300 static const cpp_token **tokens_buff_add_token (_cpp_buff *,
301 source_location *, 301 location_t *,
302 const cpp_token *, 302 const cpp_token *,
303 source_location, 303 location_t,
304 source_location, 304 location_t,
305 const line_map_macro *, 305 const line_map_macro *,
306 unsigned int); 306 unsigned int);
307 static inline void tokens_buff_remove_last_token (_cpp_buff *); 307 static inline void tokens_buff_remove_last_token (_cpp_buff *);
308 static void replace_args (cpp_reader *, cpp_hashnode *, cpp_macro *, 308 static void replace_args (cpp_reader *, cpp_hashnode *, cpp_macro *,
309 macro_arg *, source_location); 309 macro_arg *, location_t);
310 static _cpp_buff *funlike_invocation_p (cpp_reader *, cpp_hashnode *, 310 static _cpp_buff *funlike_invocation_p (cpp_reader *, cpp_hashnode *,
311 _cpp_buff **, unsigned *); 311 _cpp_buff **, unsigned *);
312 static cpp_macro *create_iso_definition (cpp_reader *); 312 static cpp_macro *create_iso_definition (cpp_reader *);
313 313
314 /* #define directive parsing and handling. */ 314 /* #define directive parsing and handling. */
320 static void check_trad_stringification (cpp_reader *, const cpp_macro *, 320 static void check_trad_stringification (cpp_reader *, const cpp_macro *,
321 const cpp_string *); 321 const cpp_string *);
322 static bool reached_end_of_context (cpp_context *); 322 static bool reached_end_of_context (cpp_context *);
323 static void consume_next_token_from_context (cpp_reader *pfile, 323 static void consume_next_token_from_context (cpp_reader *pfile,
324 const cpp_token **, 324 const cpp_token **,
325 source_location *); 325 location_t *);
326 static const cpp_token* cpp_get_token_1 (cpp_reader *, source_location *); 326 static const cpp_token* cpp_get_token_1 (cpp_reader *, location_t *);
327 327
328 static cpp_hashnode* macro_of_context (cpp_context *context); 328 static cpp_hashnode* macro_of_context (cpp_context *context);
329 329
330 static bool in_macro_expansion_p (cpp_reader *pfile); 330 static bool in_macro_expansion_p (cpp_reader *pfile);
331 331
334 unsigned num_expanded_macros_counter = 0; 334 unsigned num_expanded_macros_counter = 0;
335 /* Statistical counter tracking the total number tokens resulting 335 /* Statistical counter tracking the total number tokens resulting
336 from macro expansion. */ 336 from macro expansion. */
337 unsigned num_macro_tokens_counter = 0; 337 unsigned num_macro_tokens_counter = 0;
338 338
339 /* Wrapper around cpp_get_token to skip CPP_PADDING tokens
340 and not consume CPP_EOF. */
341 static const cpp_token *
342 cpp_get_token_no_padding (cpp_reader *pfile)
343 {
344 for (;;)
345 {
346 const cpp_token *ret = cpp_peek_token (pfile, 0);
347 if (ret->type == CPP_EOF)
348 return ret;
349 ret = cpp_get_token (pfile);
350 if (ret->type != CPP_PADDING)
351 return ret;
352 }
353 }
354
355 /* Handle meeting "__has_include" builtin macro. */
356
357 static int
358 builtin_has_include (cpp_reader *pfile, cpp_hashnode *op, bool has_next)
359 {
360 int result = 0;
361
362 if (!pfile->state.in_directive)
363 cpp_error (pfile, CPP_DL_ERROR,
364 "\"%s\" used outside of preprocessing directive",
365 NODE_NAME (op));
366
367 pfile->state.angled_headers = true;
368 const cpp_token *token = cpp_get_token_no_padding (pfile);
369 bool paren = token->type == CPP_OPEN_PAREN;
370 if (paren)
371 token = cpp_get_token_no_padding (pfile);
372 else
373 cpp_error (pfile, CPP_DL_ERROR,
374 "missing '(' before \"%s\" operand", NODE_NAME (op));
375 pfile->state.angled_headers = false;
376
377 bool bracket = token->type != CPP_STRING;
378 char *fname = NULL;
379 if (token->type == CPP_STRING || token->type == CPP_HEADER_NAME)
380 {
381 fname = XNEWVEC (char, token->val.str.len - 1);
382 memcpy (fname, token->val.str.text + 1, token->val.str.len - 2);
383 fname[token->val.str.len - 2] = '\0';
384 }
385 else if (token->type == CPP_LESS)
386 fname = _cpp_bracket_include (pfile);
387 else
388 cpp_error (pfile, CPP_DL_ERROR,
389 "operator \"%s\" requires a header-name", NODE_NAME (op));
390
391 if (fname)
392 {
393 /* Do not do the lookup if we're skipping, that's unnecessary
394 IO. */
395 if (!pfile->state.skip_eval
396 && _cpp_has_header (pfile, fname, bracket,
397 has_next ? IT_INCLUDE_NEXT : IT_INCLUDE))
398 result = 1;
399
400 XDELETEVEC (fname);
401 }
402
403 if (paren
404 && cpp_get_token_no_padding (pfile)->type != CPP_CLOSE_PAREN)
405 cpp_error (pfile, CPP_DL_ERROR,
406 "missing ')' after \"%s\" operand", NODE_NAME (op));
407
408 return result;
409 }
410
339 /* Emits a warning if NODE is a macro defined in the main file that 411 /* Emits a warning if NODE is a macro defined in the main file that
340 has not been used. */ 412 has not been used. */
341 int 413 int
342 _cpp_warn_if_unused_macro (cpp_reader *pfile, cpp_hashnode *node, 414 _cpp_warn_if_unused_macro (cpp_reader *pfile, cpp_hashnode *node,
343 void *v ATTRIBUTE_UNUSED) 415 void *v ATTRIBUTE_UNUSED)
380 452
381 /* Helper function for builtin_macro. Returns the text generated by 453 /* Helper function for builtin_macro. Returns the text generated by
382 a builtin macro. */ 454 a builtin macro. */
383 const uchar * 455 const uchar *
384 _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node, 456 _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node,
385 source_location loc) 457 location_t loc)
386 { 458 {
387 const uchar *result = NULL; 459 const uchar *result = NULL;
388 linenum_type number = 1; 460 linenum_type number = 1;
389 461
390 switch (node->value.builtin) 462 switch (node->value.builtin)
566 break; 638 break;
567 639
568 case BT_HAS_ATTRIBUTE: 640 case BT_HAS_ATTRIBUTE:
569 number = pfile->cb.has_attribute (pfile); 641 number = pfile->cb.has_attribute (pfile);
570 break; 642 break;
643
644 case BT_HAS_BUILTIN:
645 number = pfile->cb.has_builtin (pfile);
646 break;
647
648 case BT_HAS_INCLUDE:
649 case BT_HAS_INCLUDE_NEXT:
650 number = builtin_has_include (pfile, node,
651 node->value.builtin == BT_HAS_INCLUDE_NEXT);
652 break;
571 } 653 }
572 654
573 if (result == NULL) 655 if (result == NULL)
574 { 656 {
575 /* 21 bytes holds all NUL-terminated unsigned 64-bit numbers. */ 657 /* 21 bytes holds all NUL-terminated unsigned 64-bit numbers. */
585 be created. Returns 1 if it generates a new token context, 0 to 667 be created. Returns 1 if it generates a new token context, 0 to
586 return the token to the caller. LOC is the location of the expansion 668 return the token to the caller. LOC is the location of the expansion
587 point of the macro. */ 669 point of the macro. */
588 static int 670 static int
589 builtin_macro (cpp_reader *pfile, cpp_hashnode *node, 671 builtin_macro (cpp_reader *pfile, cpp_hashnode *node,
590 source_location loc, source_location expand_loc) 672 location_t loc, location_t expand_loc)
591 { 673 {
592 const uchar *buf; 674 const uchar *buf;
593 size_t len; 675 size_t len;
594 char *nbuf; 676 char *nbuf;
595 677
621 { 703 {
622 /* We are tracking tokens resulting from macro expansion. 704 /* We are tracking tokens resulting from macro expansion.
623 Create a macro line map and generate a virtual location for 705 Create a macro line map and generate a virtual location for
624 the token resulting from the expansion of the built-in 706 the token resulting from the expansion of the built-in
625 macro. */ 707 macro. */
626 source_location *virt_locs = NULL; 708 location_t *virt_locs = NULL;
627 _cpp_buff *token_buf = tokens_buff_new (pfile, 1, &virt_locs); 709 _cpp_buff *token_buf = tokens_buff_new (pfile, 1, &virt_locs);
628 const line_map_macro * map = 710 const line_map_macro * map =
629 linemap_enter_macro (pfile->line_table, node, loc, 1); 711 linemap_enter_macro (pfile->line_table, node, loc, 1);
630 tokens_buff_add_token (token_buf, virt_locs, token, 712 tokens_buff_add_token (token_buf, virt_locs, token,
631 pfile->line_table->builtin_location, 713 pfile->line_table->builtin_location,
771 /* Try to paste two tokens. On success, return nonzero. In any 853 /* Try to paste two tokens. On success, return nonzero. In any
772 case, PLHS is updated to point to the pasted token, which is 854 case, PLHS is updated to point to the pasted token, which is
773 guaranteed to not have the PASTE_LEFT flag set. LOCATION is 855 guaranteed to not have the PASTE_LEFT flag set. LOCATION is
774 the virtual location used for error reporting. */ 856 the virtual location used for error reporting. */
775 static bool 857 static bool
776 paste_tokens (cpp_reader *pfile, source_location location, 858 paste_tokens (cpp_reader *pfile, location_t location,
777 const cpp_token **plhs, const cpp_token *rhs) 859 const cpp_token **plhs, const cpp_token *rhs)
778 { 860 {
779 unsigned char *buf, *end, *lhsend; 861 unsigned char *buf, *end, *lhsend;
780 cpp_token *lhs; 862 cpp_token *lhs;
781 unsigned int len; 863 unsigned int len;
801 /* Set pfile->cur_token as required by _cpp_lex_direct. */ 883 /* Set pfile->cur_token as required by _cpp_lex_direct. */
802 pfile->cur_token = _cpp_temp_token (pfile); 884 pfile->cur_token = _cpp_temp_token (pfile);
803 lhs = _cpp_lex_direct (pfile); 885 lhs = _cpp_lex_direct (pfile);
804 if (pfile->buffer->cur != pfile->buffer->rlimit) 886 if (pfile->buffer->cur != pfile->buffer->rlimit)
805 { 887 {
806 source_location saved_loc = lhs->src_loc; 888 location_t saved_loc = lhs->src_loc;
807 889
808 _cpp_pop_buffer (pfile); 890 _cpp_pop_buffer (pfile);
809 _cpp_backup_tokens (pfile, 1); 891 _cpp_backup_tokens (pfile, 1);
810 *lhsend = '\0'; 892 *lhsend = '\0';
811 893
839 static void 921 static void
840 paste_all_tokens (cpp_reader *pfile, const cpp_token *lhs) 922 paste_all_tokens (cpp_reader *pfile, const cpp_token *lhs)
841 { 923 {
842 const cpp_token *rhs = NULL; 924 const cpp_token *rhs = NULL;
843 cpp_context *context = pfile->context; 925 cpp_context *context = pfile->context;
844 source_location virt_loc = 0; 926 location_t virt_loc = 0;
845 927
846 /* We are expanding a macro and we must have been called on a token 928 /* We are expanding a macro and we must have been called on a token
847 that appears at the left hand side of a ## operator. */ 929 that appears at the left hand side of a ## operator. */
848 if (macro_of_context (pfile->context) == NULL 930 if (macro_of_context (pfile->context) == NULL
849 || (!(lhs->flags & PASTE_LEFT))) 931 || (!(lhs->flags & PASTE_LEFT)))
901 while (rhs->flags & PASTE_LEFT); 983 while (rhs->flags & PASTE_LEFT);
902 984
903 /* Put the resulting token in its own context. */ 985 /* Put the resulting token in its own context. */
904 if (context->tokens_kind == TOKENS_KIND_EXTENDED) 986 if (context->tokens_kind == TOKENS_KIND_EXTENDED)
905 { 987 {
906 source_location *virt_locs = NULL; 988 location_t *virt_locs = NULL;
907 _cpp_buff *token_buf = tokens_buff_new (pfile, 1, &virt_locs); 989 _cpp_buff *token_buf = tokens_buff_new (pfile, 1, &virt_locs);
908 tokens_buff_add_token (token_buf, virt_locs, lhs, 990 tokens_buff_add_token (token_buf, virt_locs, lhs,
909 virt_loc, 0, NULL, 0); 991 virt_loc, 0, NULL, 0);
910 push_extended_tokens_context (pfile, context->c.mc->macro_node, 992 push_extended_tokens_context (pfile, context->c.mc->macro_node,
911 token_buf, virt_locs, 993 token_buf, virt_locs,
991 _cpp_buff *buff, *base_buff; 1073 _cpp_buff *buff, *base_buff;
992 cpp_macro *macro; 1074 cpp_macro *macro;
993 macro_arg *args, *arg; 1075 macro_arg *args, *arg;
994 const cpp_token *token; 1076 const cpp_token *token;
995 unsigned int argc; 1077 unsigned int argc;
996 source_location virt_loc; 1078 location_t virt_loc;
997 bool track_macro_expansion_p = CPP_OPTION (pfile, track_macro_expansion); 1079 bool track_macro_expansion_p = CPP_OPTION (pfile, track_macro_expansion);
998 unsigned num_args_alloced = 0; 1080 unsigned num_args_alloced = 0;
999 1081
1000 macro = node->value.macro; 1082 macro = node->value.macro;
1001 if (macro->paramc) 1083 if (macro->paramc)
1028 argc++; 1110 argc++;
1029 arg->first = (const cpp_token **) buff->cur; 1111 arg->first = (const cpp_token **) buff->cur;
1030 if (track_macro_expansion_p) 1112 if (track_macro_expansion_p)
1031 { 1113 {
1032 virt_locs_capacity = DEFAULT_NUM_TOKENS_PER_MACRO_ARG; 1114 virt_locs_capacity = DEFAULT_NUM_TOKENS_PER_MACRO_ARG;
1033 arg->virt_locs = XNEWVEC (source_location, 1115 arg->virt_locs = XNEWVEC (location_t,
1034 virt_locs_capacity); 1116 virt_locs_capacity);
1035 } 1117 }
1036 1118
1037 for (;;) 1119 for (;;)
1038 { 1120 {
1046 } 1128 }
1047 if (track_macro_expansion_p 1129 if (track_macro_expansion_p
1048 && (ntokens + 2 > virt_locs_capacity)) 1130 && (ntokens + 2 > virt_locs_capacity))
1049 { 1131 {
1050 virt_locs_capacity += ARG_TOKENS_EXTENT; 1132 virt_locs_capacity += ARG_TOKENS_EXTENT;
1051 arg->virt_locs = XRESIZEVEC (source_location, 1133 arg->virt_locs = XRESIZEVEC (location_t,
1052 arg->virt_locs, 1134 arg->virt_locs,
1053 virt_locs_capacity); 1135 virt_locs_capacity);
1054 } 1136 }
1055 1137
1056 token = cpp_get_token_1 (pfile, &virt_loc); 1138 token = cpp_get_token_1 (pfile, &virt_loc);
1258 and return two. Otherwise, we don't push a context and return 1340 and return two. Otherwise, we don't push a context and return
1259 zero. LOCATION is the location of the expansion point of the 1341 zero. LOCATION is the location of the expansion point of the
1260 macro. */ 1342 macro. */
1261 static int 1343 static int
1262 enter_macro_context (cpp_reader *pfile, cpp_hashnode *node, 1344 enter_macro_context (cpp_reader *pfile, cpp_hashnode *node,
1263 const cpp_token *result, source_location location) 1345 const cpp_token *result, location_t location)
1264 { 1346 {
1265 /* The presence of a macro invalidates a file's controlling macro. */ 1347 /* The presence of a macro invalidates a file's controlling macro. */
1266 pfile->mi_valid = false; 1348 pfile->mi_valid = false;
1267 1349
1268 pfile->state.angled_headers = false; 1350 pfile->state.angled_headers = false;
1338 if (CPP_OPTION (pfile, track_macro_expansion)) 1420 if (CPP_OPTION (pfile, track_macro_expansion))
1339 { 1421 {
1340 unsigned int i; 1422 unsigned int i;
1341 const cpp_token *src = macro->exp.tokens; 1423 const cpp_token *src = macro->exp.tokens;
1342 const line_map_macro *map; 1424 const line_map_macro *map;
1343 source_location *virt_locs = NULL; 1425 location_t *virt_locs = NULL;
1344 _cpp_buff *macro_tokens 1426 _cpp_buff *macro_tokens
1345 = tokens_buff_new (pfile, tokens_count, &virt_locs); 1427 = tokens_buff_new (pfile, tokens_count, &virt_locs);
1346 1428
1347 /* Create a macro map to record the locations of the 1429 /* Create a macro map to record the locations of the
1348 tokens that are involved in the expansion. LOCATION 1430 tokens that are involved in the expansion. LOCATION
1399 } 1481 }
1400 1482
1401 pfile->about_to_expand_macro_p = false; 1483 pfile->about_to_expand_macro_p = false;
1402 /* Handle built-in macros and the _Pragma operator. */ 1484 /* Handle built-in macros and the _Pragma operator. */
1403 { 1485 {
1404 source_location expand_loc; 1486 location_t expand_loc;
1405 1487
1406 if (/* The top-level macro invocation that triggered the expansion 1488 if (/* The top-level macro invocation that triggered the expansion
1407 we are looking at is with a function-like user macro ... */ 1489 we are looking at is with a function-like user macro ... */
1408 cpp_fun_like_macro_p (pfile->top_most_macro_node) 1490 cpp_fun_like_macro_p (pfile->top_most_macro_node)
1409 /* ... and we are tracking the macro expansion. */ 1491 /* ... and we are tracking the macro expansion. */
1465 argument ARG is supposed to contain. Note that ARG must be 1547 argument ARG is supposed to contain. Note that ARG must be
1466 tailored so that it has enough room to contain INDEX + 1 numbers of 1548 tailored so that it has enough room to contain INDEX + 1 numbers of
1467 tokens, at least. */ 1549 tokens, at least. */
1468 static void 1550 static void
1469 set_arg_token (macro_arg *arg, const cpp_token *token, 1551 set_arg_token (macro_arg *arg, const cpp_token *token,
1470 source_location location, size_t index, 1552 location_t location, size_t index,
1471 enum macro_arg_token_kind kind, 1553 enum macro_arg_token_kind kind,
1472 bool track_macro_exp_p) 1554 bool track_macro_exp_p)
1473 { 1555 {
1474 const cpp_token **token_ptr; 1556 const cpp_token **token_ptr;
1475 source_location *loc = NULL; 1557 location_t *loc = NULL;
1476 1558
1477 token_ptr = 1559 token_ptr =
1478 arg_token_ptr_at (arg, index, kind, 1560 arg_token_ptr_at (arg, index, kind,
1479 track_macro_exp_p ? &loc : NULL); 1561 track_macro_exp_p ? &loc : NULL);
1480 *token_ptr = token; 1562 *token_ptr = token;
1491 } 1573 }
1492 1574
1493 /* Get the pointer to the location of the argument token of the 1575 /* Get the pointer to the location of the argument token of the
1494 function-like macro argument ARG. This function must be called 1576 function-like macro argument ARG. This function must be called
1495 only when we -ftrack-macro-expansion is on. */ 1577 only when we -ftrack-macro-expansion is on. */
1496 static const source_location * 1578 static const location_t *
1497 get_arg_token_location (const macro_arg *arg, 1579 get_arg_token_location (const macro_arg *arg,
1498 enum macro_arg_token_kind kind) 1580 enum macro_arg_token_kind kind)
1499 { 1581 {
1500 const source_location *loc = NULL; 1582 const location_t *loc = NULL;
1501 const cpp_token **token_ptr = 1583 const cpp_token **token_ptr =
1502 arg_token_ptr_at (arg, 0, kind, (source_location **) &loc); 1584 arg_token_ptr_at (arg, 0, kind, (location_t **) &loc);
1503 1585
1504 if (token_ptr == NULL) 1586 if (token_ptr == NULL)
1505 return NULL; 1587 return NULL;
1506 1588
1507 return loc; 1589 return loc;
1514 -ftrack-macro-expansion flag is on; otherwise, it's set to the 1596 -ftrack-macro-expansion flag is on; otherwise, it's set to the
1515 spelling location of the returned token. */ 1597 spelling location of the returned token. */
1516 static const cpp_token ** 1598 static const cpp_token **
1517 arg_token_ptr_at (const macro_arg *arg, size_t index, 1599 arg_token_ptr_at (const macro_arg *arg, size_t index,
1518 enum macro_arg_token_kind kind, 1600 enum macro_arg_token_kind kind,
1519 source_location **virt_location) 1601 location_t **virt_location)
1520 { 1602 {
1521 const cpp_token **tokens_ptr = NULL; 1603 const cpp_token **tokens_ptr = NULL;
1522 1604
1523 switch (kind) 1605 switch (kind)
1524 { 1606 {
1544 *virt_location = &arg->virt_locs[index]; 1626 *virt_location = &arg->virt_locs[index];
1545 else if (kind == MACRO_ARG_TOKEN_EXPANDED) 1627 else if (kind == MACRO_ARG_TOKEN_EXPANDED)
1546 *virt_location = &arg->expanded_virt_locs[index]; 1628 *virt_location = &arg->expanded_virt_locs[index];
1547 else if (kind == MACRO_ARG_TOKEN_STRINGIFIED) 1629 else if (kind == MACRO_ARG_TOKEN_STRINGIFIED)
1548 *virt_location = 1630 *virt_location =
1549 (source_location *) &tokens_ptr[index]->src_loc; 1631 (location_t *) &tokens_ptr[index]->src_loc;
1550 } 1632 }
1551 return &tokens_ptr[index]; 1633 return &tokens_ptr[index];
1552 } 1634 }
1553 1635
1554 /* Initialize an iterator so that it iterates over the tokens of a 1636 /* Initialize an iterator so that it iterates over the tokens of a
1621 return NULL; 1703 return NULL;
1622 return *it->token_ptr; 1704 return *it->token_ptr;
1623 } 1705 }
1624 1706
1625 /* Return the location of the token pointed to by the iterator.*/ 1707 /* Return the location of the token pointed to by the iterator.*/
1626 static source_location 1708 static location_t
1627 macro_arg_token_iter_get_location (const macro_arg_token_iter *it) 1709 macro_arg_token_iter_get_location (const macro_arg_token_iter *it)
1628 { 1710 {
1629 #if CHECKING_P 1711 #if CHECKING_P
1630 if (it->kind == MACRO_ARG_TOKEN_STRINGIFIED 1712 if (it->kind == MACRO_ARG_TOKEN_STRINGIFIED
1631 && it->num_forwards > 0) 1713 && it->num_forwards > 0)
1718 by the # or ## operators. EXPANSION_POINT_LOC is the location of 1800 by the # or ## operators. EXPANSION_POINT_LOC is the location of
1719 the expansion point of the macro. E.g, the location of the 1801 the expansion point of the macro. E.g, the location of the
1720 function-like macro invocation. */ 1802 function-like macro invocation. */
1721 static void 1803 static void
1722 replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro, 1804 replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro,
1723 macro_arg *args, source_location expansion_point_loc) 1805 macro_arg *args, location_t expansion_point_loc)
1724 { 1806 {
1725 unsigned int i, total; 1807 unsigned int i, total;
1726 const cpp_token *src, *limit; 1808 const cpp_token *src, *limit;
1727 const cpp_token **first = NULL; 1809 const cpp_token **first = NULL;
1728 macro_arg *arg; 1810 macro_arg *arg;
1729 _cpp_buff *buff = NULL; 1811 _cpp_buff *buff = NULL;
1730 source_location *virt_locs = NULL; 1812 location_t *virt_locs = NULL;
1731 unsigned int exp_count; 1813 unsigned int exp_count;
1732 const line_map_macro *map = NULL; 1814 const line_map_macro *map = NULL;
1733 int track_macro_exp; 1815 int track_macro_exp;
1734 1816
1735 /* First, fully macro-expand arguments, calculating the number of 1817 /* First, fully macro-expand arguments, calculating the number of
1795 store the tokens and their locations is going to be freed once 1877 store the tokens and their locations is going to be freed once
1796 the context of macro expansion is popped. 1878 the context of macro expansion is popped.
1797 1879
1798 As far as tokens are concerned, the memory overhead of 1880 As far as tokens are concerned, the memory overhead of
1799 -ftrack-macro-expansion is proportional to the number of 1881 -ftrack-macro-expansion is proportional to the number of
1800 macros that get expanded multiplied by sizeof (source_location). 1882 macros that get expanded multiplied by sizeof (location_t).
1801 The good news is that extra memory gets freed when the macro 1883 The good news is that extra memory gets freed when the macro
1802 context is freed, i.e shortly after the macro got expanded. */ 1884 context is freed, i.e shortly after the macro got expanded. */
1803 1885
1804 /* Is the -ftrack-macro-expansion flag in effect? */ 1886 /* Is the -ftrack-macro-expansion flag in effect? */
1805 track_macro_exp = CPP_OPTION (pfile, track_macro_expansion); 1887 track_macro_exp = CPP_OPTION (pfile, track_macro_expansion);
2214 the current macro. */ 2296 the current macro. */
2215 static void 2297 static void
2216 push_extended_tokens_context (cpp_reader *pfile, 2298 push_extended_tokens_context (cpp_reader *pfile,
2217 cpp_hashnode *macro, 2299 cpp_hashnode *macro,
2218 _cpp_buff *token_buff, 2300 _cpp_buff *token_buff,
2219 source_location *virt_locs, 2301 location_t *virt_locs,
2220 const cpp_token **first, 2302 const cpp_token **first,
2221 unsigned int count) 2303 unsigned int count)
2222 { 2304 {
2223 cpp_context *context; 2305 cpp_context *context;
2224 macro_context *m; 2306 macro_context *m;
2260 *VIRT_LOCS is set to a newly allocated buffer that is supposed to 2342 *VIRT_LOCS is set to a newly allocated buffer that is supposed to
2261 hold the virtual locations of the tokens resulting from macro 2343 hold the virtual locations of the tokens resulting from macro
2262 expansion. */ 2344 expansion. */
2263 static _cpp_buff* 2345 static _cpp_buff*
2264 tokens_buff_new (cpp_reader *pfile, size_t len, 2346 tokens_buff_new (cpp_reader *pfile, size_t len,
2265 source_location **virt_locs) 2347 location_t **virt_locs)
2266 { 2348 {
2267 size_t tokens_size = len * sizeof (cpp_token *); 2349 size_t tokens_size = len * sizeof (cpp_token *);
2268 size_t locs_size = len * sizeof (source_location); 2350 size_t locs_size = len * sizeof (location_t);
2269 2351
2270 if (virt_locs != NULL) 2352 if (virt_locs != NULL)
2271 *virt_locs = XNEWVEC (source_location, locs_size); 2353 *virt_locs = XNEWVEC (location_t, locs_size);
2272 return _cpp_get_buff (pfile, tokens_size); 2354 return _cpp_get_buff (pfile, tokens_size);
2273 } 2355 }
2274 2356
2275 /* Returns the number of tokens contained in a token buffer. The 2357 /* Returns the number of tokens contained in a token buffer. The
2276 buffer holds a set of cpp_token*. */ 2358 buffer holds a set of cpp_token*. */
2323 Upon successful completion this function returns the a pointer to 2405 Upon successful completion this function returns the a pointer to
2324 the position of the token coming right after the insertion 2406 the position of the token coming right after the insertion
2325 point. */ 2407 point. */
2326 static inline const cpp_token ** 2408 static inline const cpp_token **
2327 tokens_buff_put_token_to (const cpp_token **dest, 2409 tokens_buff_put_token_to (const cpp_token **dest,
2328 source_location *virt_loc_dest, 2410 location_t *virt_loc_dest,
2329 const cpp_token *token, 2411 const cpp_token *token,
2330 source_location virt_loc, 2412 location_t virt_loc,
2331 source_location parm_def_loc, 2413 location_t parm_def_loc,
2332 const line_map_macro *map, 2414 const line_map_macro *map,
2333 unsigned int macro_token_index) 2415 unsigned int macro_token_index)
2334 { 2416 {
2335 source_location macro_loc = virt_loc; 2417 location_t macro_loc = virt_loc;
2336 const cpp_token **result; 2418 const cpp_token **result;
2337 2419
2338 if (virt_loc_dest) 2420 if (virt_loc_dest)
2339 { 2421 {
2340 /* -ftrack-macro-expansion is on. */ 2422 /* -ftrack-macro-expansion is on. */
2368 array, at the same index as the one of TOKEN in BUFFER. Upon 2450 array, at the same index as the one of TOKEN in BUFFER. Upon
2369 successful completion this function returns the a pointer to the 2451 successful completion this function returns the a pointer to the
2370 position of the token coming right after the insertion point. */ 2452 position of the token coming right after the insertion point. */
2371 static const cpp_token ** 2453 static const cpp_token **
2372 tokens_buff_add_token (_cpp_buff *buffer, 2454 tokens_buff_add_token (_cpp_buff *buffer,
2373 source_location *virt_locs, 2455 location_t *virt_locs,
2374 const cpp_token *token, 2456 const cpp_token *token,
2375 source_location virt_loc, 2457 location_t virt_loc,
2376 source_location parm_def_loc, 2458 location_t parm_def_loc,
2377 const line_map_macro *map, 2459 const line_map_macro *map,
2378 unsigned int macro_token_index) 2460 unsigned int macro_token_index)
2379 { 2461 {
2380 const cpp_token **result; 2462 const cpp_token **result;
2381 source_location *virt_loc_dest = NULL; 2463 location_t *virt_loc_dest = NULL;
2382 unsigned token_index = 2464 unsigned token_index =
2383 (BUFF_FRONT (buffer) - buffer->base) / sizeof (cpp_token *); 2465 (BUFF_FRONT (buffer) - buffer->base) / sizeof (cpp_token *);
2384 2466
2385 /* Abort if we pass the end the buffer. */ 2467 /* Abort if we pass the end the buffer. */
2386 if (BUFF_FRONT (buffer) > BUFF_LIMIT (buffer)) 2468 if (BUFF_FRONT (buffer) > BUFF_LIMIT (buffer))
2408 gcc_checking_assert (arg->expanded == NULL 2490 gcc_checking_assert (arg->expanded == NULL
2409 && arg->expanded_virt_locs == NULL); 2491 && arg->expanded_virt_locs == NULL);
2410 2492
2411 arg->expanded = XNEWVEC (const cpp_token *, capacity); 2493 arg->expanded = XNEWVEC (const cpp_token *, capacity);
2412 if (CPP_OPTION (pfile, track_macro_expansion)) 2494 if (CPP_OPTION (pfile, track_macro_expansion))
2413 arg->expanded_virt_locs = XNEWVEC (source_location, capacity); 2495 arg->expanded_virt_locs = XNEWVEC (location_t, capacity);
2414 2496
2415 } 2497 }
2416 2498
2417 /* If necessary, enlarge ARG->expanded to so that it can contain SIZE 2499 /* If necessary, enlarge ARG->expanded to so that it can contain SIZE
2418 tokens. */ 2500 tokens. */
2430 *expanded_capacity = size; 2512 *expanded_capacity = size;
2431 2513
2432 if (CPP_OPTION (pfile, track_macro_expansion)) 2514 if (CPP_OPTION (pfile, track_macro_expansion))
2433 { 2515 {
2434 if (arg->expanded_virt_locs == NULL) 2516 if (arg->expanded_virt_locs == NULL)
2435 arg->expanded_virt_locs = XNEWVEC (source_location, size); 2517 arg->expanded_virt_locs = XNEWVEC (location_t, size);
2436 else 2518 else
2437 arg->expanded_virt_locs = XRESIZEVEC (source_location, 2519 arg->expanded_virt_locs = XRESIZEVEC (location_t,
2438 arg->expanded_virt_locs, 2520 arg->expanded_virt_locs,
2439 size); 2521 size);
2440 } 2522 }
2441 } 2523 }
2442 2524
2475 arg->first, arg->count + 1); 2557 arg->first, arg->count + 1);
2476 2558
2477 for (;;) 2559 for (;;)
2478 { 2560 {
2479 const cpp_token *token; 2561 const cpp_token *token;
2480 source_location location; 2562 location_t location;
2481 2563
2482 ensure_expanded_arg_room (pfile, arg, arg->expanded_count + 1, 2564 ensure_expanded_arg_room (pfile, arg, arg->expanded_count + 1,
2483 &capacity); 2565 &capacity);
2484 2566
2485 token = cpp_get_token_1 (pfile, &location); 2567 token = cpp_get_token_1 (pfile, &location);
2614 expansion; otherwise it's just is the "normal" location of the 2696 expansion; otherwise it's just is the "normal" location of the
2615 token which (*TOKEN)->src_loc. */ 2697 token which (*TOKEN)->src_loc. */
2616 static inline void 2698 static inline void
2617 consume_next_token_from_context (cpp_reader *pfile, 2699 consume_next_token_from_context (cpp_reader *pfile,
2618 const cpp_token ** token, 2700 const cpp_token ** token,
2619 source_location *location) 2701 location_t *location)
2620 { 2702 {
2621 cpp_context *c = pfile->context; 2703 cpp_context *c = pfile->context;
2622 2704
2623 if ((c)->tokens_kind == TOKENS_KIND_DIRECT) 2705 if ((c)->tokens_kind == TOKENS_KIND_DIRECT)
2624 { 2706 {
2653 a directive, the location of a token must be the location of the 2735 a directive, the location of a token must be the location of the
2654 start of the directive line. This function returns the proper 2736 start of the directive line. This function returns the proper
2655 location if we are in the traditional mode, and just returns 2737 location if we are in the traditional mode, and just returns
2656 LOCATION otherwise. */ 2738 LOCATION otherwise. */
2657 2739
2658 static inline source_location 2740 static inline location_t
2659 maybe_adjust_loc_for_trad_cpp (cpp_reader *pfile, source_location location) 2741 maybe_adjust_loc_for_trad_cpp (cpp_reader *pfile, location_t location)
2660 { 2742 {
2661 if (CPP_OPTION (pfile, traditional)) 2743 if (CPP_OPTION (pfile, traditional))
2662 { 2744 {
2663 if (pfile->state.in_directive) 2745 if (pfile->state.in_directive)
2664 return pfile->directive_line; 2746 return pfile->directive_line;
2679 LOC is an out parameter; *LOC is set to the location "as expected 2761 LOC is an out parameter; *LOC is set to the location "as expected
2680 by the user". Please read the comment of 2762 by the user". Please read the comment of
2681 cpp_get_token_with_location to learn more about the meaning of this 2763 cpp_get_token_with_location to learn more about the meaning of this
2682 location. */ 2764 location. */
2683 static const cpp_token* 2765 static const cpp_token*
2684 cpp_get_token_1 (cpp_reader *pfile, source_location *location) 2766 cpp_get_token_1 (cpp_reader *pfile, location_t *location)
2685 { 2767 {
2686 const cpp_token *result; 2768 const cpp_token *result;
2687 /* This token is a virtual token that either encodes a location 2769 /* This token is a virtual token that either encodes a location
2688 related to macro expansion or a spelling location. */ 2770 related to macro expansion or a spelling location. */
2689 source_location virt_loc = 0; 2771 location_t virt_loc = 0;
2690 /* pfile->about_to_expand_macro_p can be overriden by indirect calls 2772 /* pfile->about_to_expand_macro_p can be overriden by indirect calls
2691 to functions that push macro contexts. So let's save it so that 2773 to functions that push macro contexts. So let's save it so that
2692 we can restore it when we are about to leave this routine. */ 2774 we can restore it when we are about to leave this routine. */
2693 bool saved_about_to_expand_macro = pfile->about_to_expand_macro_p; 2775 bool saved_about_to_expand_macro = pfile->about_to_expand_macro_p;
2694 2776
2882 2964
2883 When the token doesn't result from macro expansion, the virtual 2965 When the token doesn't result from macro expansion, the virtual
2884 location is just the same thing as its spelling location. */ 2966 location is just the same thing as its spelling location. */
2885 2967
2886 const cpp_token * 2968 const cpp_token *
2887 cpp_get_token_with_location (cpp_reader *pfile, source_location *loc) 2969 cpp_get_token_with_location (cpp_reader *pfile, location_t *loc)
2888 { 2970 {
2889 return cpp_get_token_1 (pfile, loc); 2971 return cpp_get_token_1 (pfile, loc);
2890 } 2972 }
2891 2973
2892 /* Returns true if we're expanding an object-like macro that was 2974 /* Returns true if we're expanding an object-like macro that was
2978 } 3060 }
2979 } 3061 }
2980 3062
2981 /* #define directive parsing and handling. */ 3063 /* #define directive parsing and handling. */
2982 3064
2983 /* Returns nonzero if a macro redefinition warning is required. */ 3065 /* Returns true if a macro redefinition warning is required. */
2984 static bool 3066 static bool
2985 warn_of_redefinition (cpp_reader *pfile, cpp_hashnode *node, 3067 warn_of_redefinition (cpp_reader *pfile, cpp_hashnode *node,
2986 const cpp_macro *macro2) 3068 const cpp_macro *macro2)
2987 { 3069 {
2988 unsigned int i;
2989
2990 /* Some redefinitions need to be warned about regardless. */ 3070 /* Some redefinitions need to be warned about regardless. */
2991 if (node->flags & NODE_WARN) 3071 if (node->flags & NODE_WARN)
2992 return true; 3072 return true;
2993 3073
2994 /* Suppress warnings for builtins that lack the NODE_WARN flag, 3074 /* Suppress warnings for builtins that lack the NODE_WARN flag,
3019 || macro1->fun_like != macro2->fun_like 3099 || macro1->fun_like != macro2->fun_like
3020 || macro1->variadic != macro2->variadic) 3100 || macro1->variadic != macro2->variadic)
3021 return true; 3101 return true;
3022 3102
3023 /* Check parameter spellings. */ 3103 /* Check parameter spellings. */
3024 for (i = 0; i < macro1->paramc; i++) 3104 for (unsigned i = macro1->paramc; i--; )
3025 if (macro1->parm.params[i] != macro2->parm.params[i]) 3105 if (macro1->parm.params[i] != macro2->parm.params[i])
3026 return true; 3106 return true;
3027 3107
3028 /* Check the replacement text or tokens. */ 3108 /* Check the replacement text or tokens. */
3029 if (CPP_OPTION (pfile, traditional)) 3109 if (macro1->kind == cmk_traditional)
3030 return _cpp_expansions_different_trad (macro1, macro2); 3110 return _cpp_expansions_different_trad (macro1, macro2);
3031 3111
3032 if (macro1->count != macro2->count) 3112 if (macro1->count != macro2->count)
3033 return true; 3113 return true;
3034 3114
3035 for (i = 0; i < macro1->count; i++) 3115 for (unsigned i= macro1->count; i--; )
3036 if (!_cpp_equiv_tokens (&macro1->exp.tokens[i], &macro2->exp.tokens[i])) 3116 if (!_cpp_equiv_tokens (&macro1->exp.tokens[i], &macro2->exp.tokens[i]))
3037 return true; 3117 return true;
3038 3118
3039 return false; 3119 return false;
3040 } 3120 }
3437 3517
3438 macro = (cpp_macro *)_cpp_commit_buff 3518 macro = (cpp_macro *)_cpp_commit_buff
3439 (pfile, sizeof (cpp_macro) - sizeof (cpp_token) 3519 (pfile, sizeof (cpp_macro) - sizeof (cpp_token)
3440 + sizeof (cpp_token) * macro->count); 3520 + sizeof (cpp_token) * macro->count);
3441 3521
3442 /* Clear whitespace on first token for warn_of_redefinition(). */ 3522 /* Clear whitespace on first token. */
3443 if (macro->count) 3523 if (macro->count)
3444 macro->exp.tokens[0].flags &= ~PREV_WHITE; 3524 macro->exp.tokens[0].flags &= ~PREV_WHITE;
3445 3525
3446 if (num_extra_tokens) 3526 if (num_extra_tokens)
3447 { 3527 {
3765 } 3845 }
3766 3846
3767 *buffer = '\0'; 3847 *buffer = '\0';
3768 return pfile->macro_buffer; 3848 return pfile->macro_buffer;
3769 } 3849 }
3770
3771 /* Get the line at which the macro was defined. */
3772
3773 source_location
3774 cpp_macro_definition_location (cpp_hashnode *node)
3775 {
3776 return node->value.macro->line;
3777 }