comparison gcc/fortran/cpp.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 /* Copyright (C) 2008-2017 Free Software Foundation, Inc. 1 /* Copyright (C) 2008-2018 Free Software Foundation, Inc.
2 2
3 This file is part of GCC. 3 This file is part of GCC.
4 4
5 GCC is free software; you can redistribute it and/or modify it under 5 GCC is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free 6 the terms of the GNU General Public License as published by the Free
140 static void cb_include (cpp_reader *, source_location, const unsigned char *, 140 static void cb_include (cpp_reader *, source_location, const unsigned char *,
141 const char *, int, const cpp_token **); 141 const char *, int, const cpp_token **);
142 static void cb_ident (cpp_reader *, source_location, const cpp_string *); 142 static void cb_ident (cpp_reader *, source_location, const cpp_string *);
143 static void cb_used_define (cpp_reader *, source_location, cpp_hashnode *); 143 static void cb_used_define (cpp_reader *, source_location, cpp_hashnode *);
144 static void cb_used_undef (cpp_reader *, source_location, cpp_hashnode *); 144 static void cb_used_undef (cpp_reader *, source_location, cpp_hashnode *);
145 static bool cb_cpp_error (cpp_reader *, int, int, rich_location *, 145 static bool cb_cpp_diagnostic (cpp_reader *, enum cpp_diagnostic_level,
146 const char *, va_list *) 146 enum cpp_warning_reason, rich_location *,
147 const char *, va_list *)
147 ATTRIBUTE_GCC_DIAG(5,0); 148 ATTRIBUTE_GCC_DIAG(5,0);
148 void pp_dir_change (cpp_reader *, const char *); 149 void pp_dir_change (cpp_reader *, const char *);
149 150
150 static int dump_macro (cpp_reader *, cpp_hashnode *, void *); 151 static int dump_macro (cpp_reader *, cpp_hashnode *, void *);
151 static void dump_queued_macros (cpp_reader *); 152 static void dump_queued_macros (cpp_reader *);
502 cb = cpp_get_callbacks (cpp_in); 503 cb = cpp_get_callbacks (cpp_in);
503 cb->file_change = cb_file_change; 504 cb->file_change = cb_file_change;
504 cb->line_change = cb_line_change; 505 cb->line_change = cb_line_change;
505 cb->ident = cb_ident; 506 cb->ident = cb_ident;
506 cb->def_pragma = cb_def_pragma; 507 cb->def_pragma = cb_def_pragma;
507 cb->error = cb_cpp_error; 508 cb->diagnostic = cb_cpp_diagnostic;
508 509
509 if (gfc_cpp_option.dump_includes) 510 if (gfc_cpp_option.dump_includes)
510 cb->include = cb_include; 511 cb->include = cb_include;
511 512
512 if ((gfc_cpp_option.dump_macros == 'D') 513 if ((gfc_cpp_option.dump_macros == 'D')
879 } 880 }
880 else 881 else
881 { 882 {
882 /* Bring current file to correct line when entering a new file. */ 883 /* Bring current file to correct line when entering a new file. */
883 if (map->reason == LC_ENTER) 884 if (map->reason == LC_ENTER)
884 { 885 maybe_print_line (linemap_included_from (map));
885 const line_map_ordinary *from = INCLUDED_FROM (line_table, map);
886 maybe_print_line (LAST_SOURCE_LINE_LOCATION (from));
887 }
888 if (map->reason == LC_ENTER) 886 if (map->reason == LC_ENTER)
889 flags = " 1"; 887 flags = " 1";
890 else if (map->reason == LC_LEAVE) 888 else if (map->reason == LC_LEAVE)
891 flags = " 2"; 889 flags = " 2";
892 print_line (map->start_location, flags); 890 print_line (map->start_location, flags);
991 989
992 /* Dump out the hash table. */ 990 /* Dump out the hash table. */
993 static int 991 static int
994 dump_macro (cpp_reader *pfile, cpp_hashnode *node, void *v ATTRIBUTE_UNUSED) 992 dump_macro (cpp_reader *pfile, cpp_hashnode *node, void *v ATTRIBUTE_UNUSED)
995 { 993 {
996 if (node->type == NT_MACRO && !(node->flags & NODE_BUILTIN)) 994 if (cpp_user_macro_p (node))
997 { 995 {
998 fputs ("#define ", print.outf); 996 fputs ("#define ", print.outf);
999 fputs ((const char *) cpp_macro_definition (pfile, node), 997 fputs ((const char *) cpp_macro_definition (pfile, node),
1000 print.outf); 998 print.outf);
1001 putc ('\n', print.outf); 999 putc ('\n', print.outf);
1021 to the reason code if LEVEL is represents a warning, at location 1019 to the reason code if LEVEL is represents a warning, at location
1022 RICHLOC; MSG is the translated message and AP the arguments. 1020 RICHLOC; MSG is the translated message and AP the arguments.
1023 Returns true if a diagnostic was emitted, false otherwise. */ 1021 Returns true if a diagnostic was emitted, false otherwise. */
1024 1022
1025 static bool 1023 static bool
1026 cb_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level, int reason, 1024 cb_cpp_diagnostic (cpp_reader *pfile ATTRIBUTE_UNUSED,
1027 rich_location *richloc, 1025 enum cpp_diagnostic_level level,
1028 const char *msg, va_list *ap) 1026 enum cpp_warning_reason reason,
1027 rich_location *richloc,
1028 const char *msg, va_list *ap)
1029 { 1029 {
1030 diagnostic_info diagnostic; 1030 diagnostic_info diagnostic;
1031 diagnostic_t dlevel; 1031 diagnostic_t dlevel;
1032 bool save_warn_system_headers = global_dc->dc_warn_system_headers; 1032 bool save_warn_system_headers = global_dc->dc_warn_system_headers;
1033 bool ret; 1033 bool ret;