comparison libcpp/macro.c @ 63:b7f97abdc517 gcc-4.6-20100522

update gcc from gcc-4.5.0 to gcc-4.6
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 24 May 2010 12:47:05 +0900
parents 77e2b8dfacca
children f6334be47118
comparison
equal deleted inserted replaced
56:3c8a44c06a95 63:b7f97abdc517
81 { 81 {
82 cpp_macro *macro = node->value.macro; 82 cpp_macro *macro = node->value.macro;
83 83
84 if (!macro->used 84 if (!macro->used
85 && MAIN_FILE_P (linemap_lookup (pfile->line_table, macro->line))) 85 && MAIN_FILE_P (linemap_lookup (pfile->line_table, macro->line)))
86 cpp_error_with_line (pfile, CPP_DL_WARNING, macro->line, 0, 86 cpp_warning_with_line (pfile, CPP_W_UNUSED_MACROS, macro->line, 0,
87 "macro \"%s\" is not used", NODE_NAME (node)); 87 "macro \"%s\" is not used", NODE_NAME (node));
88 } 88 }
89 89
90 return 1; 90 return 1;
91 } 91 }
92 92
858 pfile->state.prevent_expansion--; 858 pfile->state.prevent_expansion--;
859 859
860 if (buff == NULL) 860 if (buff == NULL)
861 { 861 {
862 if (CPP_WTRADITIONAL (pfile) && ! node->value.macro->syshdr) 862 if (CPP_WTRADITIONAL (pfile) && ! node->value.macro->syshdr)
863 cpp_error (pfile, CPP_DL_WARNING, 863 cpp_warning (pfile, CPP_W_TRADITIONAL,
864 "function-like macro \"%s\" must be used with arguments in traditional C", 864 "function-like macro \"%s\" must be used with arguments in traditional C",
865 NODE_NAME (node)); 865 NODE_NAME (node));
866 866
867 if (pragma_buff) 867 if (pragma_buff)
868 _cpp_release_buff (pfile, pragma_buff); 868 _cpp_release_buff (pfile, pragma_buff);
869 869
870 return 0; 870 return 0;
1583 pfile->spec_nodes.n__VA_ARGS__); 1583 pfile->spec_nodes.n__VA_ARGS__);
1584 pfile->state.va_args_ok = 1; 1584 pfile->state.va_args_ok = 1;
1585 if (! CPP_OPTION (pfile, c99) 1585 if (! CPP_OPTION (pfile, c99)
1586 && CPP_OPTION (pfile, pedantic) 1586 && CPP_OPTION (pfile, pedantic)
1587 && CPP_OPTION (pfile, warn_variadic_macros)) 1587 && CPP_OPTION (pfile, warn_variadic_macros))
1588 cpp_error (pfile, CPP_DL_PEDWARN, 1588 cpp_pedwarning
1589 "anonymous variadic macros were introduced in C99"); 1589 (pfile, CPP_W_VARIADIC_MACROS,
1590 "anonymous variadic macros were introduced in C99");
1590 } 1591 }
1591 else if (CPP_OPTION (pfile, pedantic) 1592 else if (CPP_OPTION (pfile, pedantic)
1592 && CPP_OPTION (pfile, warn_variadic_macros)) 1593 && CPP_OPTION (pfile, warn_variadic_macros))
1593 cpp_error (pfile, CPP_DL_PEDWARN, 1594 cpp_pedwarning (pfile, CPP_W_VARIADIC_MACROS,
1594 "ISO C does not permit named variadic macros"); 1595 "ISO C does not permit named variadic macros");
1595 1596
1596 /* We're at the end, and just expect a closing parenthesis. */ 1597 /* We're at the end, and just expect a closing parenthesis. */
1597 token = _cpp_lex_token (pfile); 1598 token = _cpp_lex_token (pfile);
1598 if (token->type == CPP_CLOSE_PAREN) 1599 if (token->type == CPP_CLOSE_PAREN)
1599 return true; 1600 return true;
1892 if (CPP_OPTION (pfile, warn_unused_macros)) 1893 if (CPP_OPTION (pfile, warn_unused_macros))
1893 _cpp_warn_if_unused_macro (pfile, node, NULL); 1894 _cpp_warn_if_unused_macro (pfile, node, NULL);
1894 1895
1895 if (warn_of_redefinition (pfile, node, macro)) 1896 if (warn_of_redefinition (pfile, node, macro))
1896 { 1897 {
1898 const int reason = (node->flags & NODE_BUILTIN)
1899 ? CPP_W_BUILTIN_MACRO_REDEFINED : CPP_W_NONE;
1897 bool warned; 1900 bool warned;
1898 warned = cpp_error_with_line (pfile, CPP_DL_PEDWARN, 1901
1899 pfile->directive_line, 0, 1902 warned = cpp_pedwarning_with_line (pfile, reason,
1900 "\"%s\" redefined", NODE_NAME (node)); 1903 pfile->directive_line, 0,
1904 "\"%s\" redefined",
1905 NODE_NAME (node));
1901 1906
1902 if (warned && node->type == NT_MACRO && !(node->flags & NODE_BUILTIN)) 1907 if (warned && node->type == NT_MACRO && !(node->flags & NODE_BUILTIN))
1903 cpp_error_with_line (pfile, CPP_DL_NOTE, 1908 cpp_error_with_line (pfile, CPP_DL_NOTE,
1904 node->value.macro->line, 0, 1909 node->value.macro->line, 0,
1905 "this is the location of the previous definition"); 1910 "this is the location of the previous definition");