1*e4b17023SJohn Marino /* Various diagnostic subroutines for the GNU C language.
2*e4b17023SJohn Marino Copyright (C) 2000, 2001, 2003, 2007, 2008 Free Software Foundation, Inc.
3*e4b17023SJohn Marino Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
4*e4b17023SJohn Marino
5*e4b17023SJohn Marino This file is part of GCC.
6*e4b17023SJohn Marino
7*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify it under
8*e4b17023SJohn Marino the terms of the GNU General Public License as published by the Free
9*e4b17023SJohn Marino Software Foundation; either version 3, or (at your option) any later
10*e4b17023SJohn Marino version.
11*e4b17023SJohn Marino
12*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13*e4b17023SJohn Marino WARRANTY; without even the implied warranty of MERCHANTABILITY or
14*e4b17023SJohn Marino FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15*e4b17023SJohn Marino for more details.
16*e4b17023SJohn Marino
17*e4b17023SJohn Marino You should have received a copy of the GNU General Public License
18*e4b17023SJohn Marino along with GCC; see the file COPYING3. If not see
19*e4b17023SJohn Marino <http://www.gnu.org/licenses/>. */
20*e4b17023SJohn Marino
21*e4b17023SJohn Marino #include "config.h"
22*e4b17023SJohn Marino #include "system.h"
23*e4b17023SJohn Marino #include "coretypes.h"
24*e4b17023SJohn Marino #include "tm.h"
25*e4b17023SJohn Marino #include "tree.h"
26*e4b17023SJohn Marino #include "c-tree.h"
27*e4b17023SJohn Marino #include "tm_p.h"
28*e4b17023SJohn Marino #include "flags.h"
29*e4b17023SJohn Marino #include "diagnostic.h"
30*e4b17023SJohn Marino
31*e4b17023SJohn Marino /* Issue an ISO C99 pedantic warning MSGID. */
32*e4b17023SJohn Marino
33*e4b17023SJohn Marino void
pedwarn_c99(location_t location,int opt,const char * gmsgid,...)34*e4b17023SJohn Marino pedwarn_c99 (location_t location, int opt, const char *gmsgid, ...)
35*e4b17023SJohn Marino {
36*e4b17023SJohn Marino diagnostic_info diagnostic;
37*e4b17023SJohn Marino va_list ap;
38*e4b17023SJohn Marino
39*e4b17023SJohn Marino va_start (ap, gmsgid);
40*e4b17023SJohn Marino diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
41*e4b17023SJohn Marino flag_isoc99 ? DK_PEDWARN : DK_WARNING);
42*e4b17023SJohn Marino diagnostic.option_index = opt;
43*e4b17023SJohn Marino report_diagnostic (&diagnostic);
44*e4b17023SJohn Marino va_end (ap);
45*e4b17023SJohn Marino }
46*e4b17023SJohn Marino
47*e4b17023SJohn Marino /* Issue an ISO C90 pedantic warning MSGID. This function is supposed to
48*e4b17023SJohn Marino be used for matters that are allowed in ISO C99 but not supported in
49*e4b17023SJohn Marino ISO C90, thus we explicitly don't pedwarn when C99 is specified.
50*e4b17023SJohn Marino (There is no flag_c90.) */
51*e4b17023SJohn Marino
52*e4b17023SJohn Marino void
pedwarn_c90(location_t location,int opt,const char * gmsgid,...)53*e4b17023SJohn Marino pedwarn_c90 (location_t location, int opt, const char *gmsgid, ...)
54*e4b17023SJohn Marino {
55*e4b17023SJohn Marino diagnostic_info diagnostic;
56*e4b17023SJohn Marino va_list ap;
57*e4b17023SJohn Marino
58*e4b17023SJohn Marino va_start (ap, gmsgid);
59*e4b17023SJohn Marino diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
60*e4b17023SJohn Marino flag_isoc99 ? DK_WARNING : DK_PEDWARN);
61*e4b17023SJohn Marino diagnostic.option_index = opt;
62*e4b17023SJohn Marino report_diagnostic (&diagnostic);
63*e4b17023SJohn Marino va_end (ap);
64*e4b17023SJohn Marino }
65