This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Slightly extended example for named warnings
- From: Bruce Korb <bkorb at veritas dot com>
- To: gcc <gcc at gcc dot gnu dot org>
- Cc: Bruce Korb <bkorb at veritas dot com>
- Date: Sun, 26 Jan 2003 12:36:56 -0800
- Subject: Slightly extended example for named warnings
- Organization: Home
Here goes again.
The attached example output is actually highly flexible,
but extending it over the engire GCC source would enable
the fiddling with GCC error and warning handling almost any
way anyone could possibly want. You can easily do it by
number or name. Furthermore, you could even translate the
attached file into multiple languages and use dlopen instead
of gettext, opening the variant of choice. Were you to want
to do that. In any event, this incarnation has this struct
describing every "diagnostic":
> typedef struct {
> const diagnostic_t diag_type;
> diagnostic_t diag_state;
> diag_id_t diag_id;
> int* p_state_stack;
> int stack_depth;
> const char* const diag_name;
> const char* const msg_id;
> const char* localized_msg;
> const char* const doc;
> } diag_state_t;
where "doc" would be the extended warning message.
So, attached first is the generated diag-macro.h file,
followed by the diff of a couple of sample source files.
Oh, and if anyone is wondering, there's a mechanism for
keeping the diagnostic numbers static, which is how I
was able to insert an artificial hole in the sequence.
/* -*- buffer-read-only: t -*- vi: set ro:
*
* DO NOT EDIT THIS FILE (diag-macros.h)
*
* It has been AutoGen-ed
* From the definitions diag-macros.def
* and the template file diagnostic.tpl
*
* Copyright (C) 2003 Free Software Foundation, Inc.
*
* GCC is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2, or (at your option) any later version.
*
* GCC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GCC. See the file "COPYING". If not,
* write to: The Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef GCC_DIAG_MACROS_H_GUARD
#define GCC_DIAG_MACROS_H_GUARD
/*
* Enumerate the diagnostic levels
*/
typedef enum {
DK_FATAL,
DK_ICE,
DK_SORRY,
DK_ERROR,
DK_WARNING,
DK_ANACRONISM,
DK_NOTE,
DK_DEBUG,
DK_SUPPRESSED
} diagnostic_t;
#define DK_LAST_DIAGNOSTIC_KIND 8
/*
* Enumerate every diagnostic message in GCC.
* The value is the diagnostic number.
*/
typedef enum {
DIAG_WARNING_UNPUSHED_POP = 101,
DIAG_WARNING_UNPUSHED_POP_ID = 102,
DIAG_WARNING_NO_PRAGMA_PUSH_POP = 103,
DIAG_WARNING_PRAGMA_PACK_SYNTAX = 104,
DIAG_WARNING_MALFORMED_PRAGMA = 105,
DIAG_WARNING_BAD_PACK_ACTION = 106,
DIAG_WARNING_PRAGMA_JUNK = 107,
DIAG_WARNING_ALIGN_NOT_POWER_OF_2 = 108,
DIAG_WARNING_WEAK_TOO_LATE = 109,
DIAG_WARNING_REDEFINE_CONFLICT = 120,
DIAG_WARNING_RENAME_CONFLICT = 121,
DIAG_DEBUG_ENTER_HANDLE_PRAGMA_PACK = 122,
DIAG_ICE_UNSUPPORTED_WIDE_INT = 123,
DIAG_ERROR_PARAM_SIZE_DEPENDENCY = 124
} diag_id_t;
#define MIN_DIAGNOSTIC_NUM 101
#define MAX_DIAGNOSTIC_NUM 124
/*
* Message Emission Macros
*/
#ifdef DEBUG
# define ACTIVE_DIAG(n) \
(diag_states[n].diag_state < DK_SUPPRESSED)
#else
# define ACTIVE_DIAG(n) \
(diag_states[n].diag_state < DK_DEBUG)
#endif
#define WARNING_UNPUSHED_POP \
if (ACTIVE_DIAG(DIAG_WARNING_UNPUSHED_POP)) \
assemble_diagnostics (DIAG_WARNING_UNPUSHED_POP)
#define WARNING_UNPUSHED_POP_ID(_arg1, _arg2) \
if (ACTIVE_DIAG(DIAG_WARNING_UNPUSHED_POP_ID)) \
assemble_diagnostics (DIAG_WARNING_UNPUSHED_POP_ID, \
(_arg1), (_arg2))
#define WARNING_NO_PRAGMA_PUSH_POP(_arg1) \
if (ACTIVE_DIAG(DIAG_WARNING_NO_PRAGMA_PUSH_POP)) \
assemble_diagnostics (DIAG_WARNING_NO_PRAGMA_PUSH_POP, \
(_arg1))
#define WARNING_PRAGMA_PACK_SYNTAX \
if (ACTIVE_DIAG(DIAG_WARNING_PRAGMA_PACK_SYNTAX)) \
assemble_diagnostics (DIAG_WARNING_PRAGMA_PACK_SYNTAX)
#define WARNING_MALFORMED_PRAGMA(_arg1) \
if (ACTIVE_DIAG(DIAG_WARNING_MALFORMED_PRAGMA)) \
assemble_diagnostics (DIAG_WARNING_MALFORMED_PRAGMA, \
(_arg1))
#define WARNING_BAD_PACK_ACTION(_arg1) \
if (ACTIVE_DIAG(DIAG_WARNING_BAD_PACK_ACTION)) \
assemble_diagnostics (DIAG_WARNING_BAD_PACK_ACTION, \
(_arg1))
#define WARNING_PRAGMA_JUNK(_arg1) \
if (ACTIVE_DIAG(DIAG_WARNING_PRAGMA_JUNK)) \
assemble_diagnostics (DIAG_WARNING_PRAGMA_JUNK, \
(_arg1))
#define WARNING_ALIGN_NOT_POWER_OF_2(_arg1) \
if (ACTIVE_DIAG(DIAG_WARNING_ALIGN_NOT_POWER_OF_2)) \
assemble_diagnostics (DIAG_WARNING_ALIGN_NOT_POWER_OF_2, \
(_arg1))
#define WARNING_WEAK_TOO_LATE(_arg1) \
if (ACTIVE_DIAG(DIAG_WARNING_WEAK_TOO_LATE)) \
assemble_diag_with_decl (DIAG_WARNING_WEAK_TOO_LATE, \
(_arg1))
#define WARNING_REDEFINE_CONFLICT \
if (ACTIVE_DIAG(DIAG_WARNING_REDEFINE_CONFLICT)) \
assemble_diagnostics (DIAG_WARNING_REDEFINE_CONFLICT)
#define WARNING_RENAME_CONFLICT \
if (ACTIVE_DIAG(DIAG_WARNING_RENAME_CONFLICT)) \
assemble_diagnostics (DIAG_WARNING_RENAME_CONFLICT)
#ifndef DEBUG
# define DEBUG_ENTER_HANDLE_PRAGMA_PACK(_arg1)
#else
# define DEBUG_ENTER_HANDLE_PRAGMA_PACK(_arg1) \
if (ACTIVE_DIAG(DIAG_DEBUG_ENTER_HANDLE_PRAGMA_PACK)) \
assemble_diagnostics (DIAG_DEBUG_ENTER_HANDLE_PRAGMA_PACK, __FILE__, __LINE__, \
(_arg1))
#endif /* DEBUG */
#define ICE_UNSUPPORTED_WIDE_INT \
assemble_diagnostics (DIAG_ICE_UNSUPPORTED_WIDE_INT)
#define ERROR_PARAM_SIZE_DEPENDENCY(_arg1) \
if (ACTIVE_DIAG(DIAG_ERROR_PARAM_SIZE_DEPENDENCY)) \
assemble_diag_with_decl (DIAG_ERROR_PARAM_SIZE_DEPENDENCY, \
(_arg1))
typedef struct {
const diagnostic_t diag_type;
diagnostic_t diag_state;
diag_id_t diag_id;
int* p_state_stack;
int stack_depth;
const char* const diag_name;
const char* const msg_id;
const char* localized_msg;
const char* const doc;
} diag_state_t;
extern diag_state_t diag_states[ 24 ];
#ifdef DEFINE_DIAGNOSTICS
diag_state_t diag_states[ 24 ] = {
/*
* Warning 101 defined in c-pragma.c on line 106
*/
{ DK_WARNING, DK_WARNING, DIAG_WARNING_UNPUSHED_POP,
NULL, 0, "unpushed-pop",
"#pragma pack (pop) encountered without matching #pragma pack (push, <n>)", NULL,
"These must match up. You may find unifdef(1BSD) useful." },
/*
* Warning 102 defined in c-pragma.c on line 128
*/
{ DK_WARNING, DK_WARNING, DIAG_WARNING_UNPUSHED_POP_ID,
NULL, 0, "unpushed-pop-id",
"#pragma pack(pop, %s) encountered without matching #pragma pack(push, %s, <n>)", NULL,
"These must match up. You may find unifdef(1BSD) useful." },
/*
* Warning 103 defined in c-pragma.c on line 152
*/
{ DK_WARNING, DK_WARNING, DIAG_WARNING_NO_PRAGMA_PUSH_POP,
NULL, 0, "no-pragma-push-pop",
"#pragma pack(%s[, id], <n>) is not supported on this target", NULL,
"If you have a choice about the data structure, then reorder\n\
the items so they are always aligned consistently. Otherwise,\n\
you need to study the default layout and make sure that if you\n\
move the data to another machine that it is consistent." },
/*
* Warning 104 defined in c-pragma.c on line 188
*/
{ DK_WARNING, DK_WARNING, DIAG_WARNING_PRAGMA_PACK_SYNTAX,
NULL, 0, "pragma-pack-syntax",
"missing '(' after '#pragma pack' - ignored", NULL,
"The syntax is: \"#pragma pack (???)\" where \"???\" is:\n\
\"N\", \"push, N\", \"push, ID, N\", \"pop\", or \"pop, ID\"." },
/*
* Warning 105 defined in c-pragma.c on line 207
*/
{ DK_WARNING, DK_WARNING, DIAG_WARNING_MALFORMED_PRAGMA,
NULL, 0, "malformed-pragma",
"malformed '#pragma %s' - ignored", NULL,
"The syntax is: \"#pragma pack (???)\" where \"???\" is:\n\
\"N\", \"push, N\", \"push, ID, N\", \"pop\", or \"pop, ID\"." },
/*
* Warning 106 defined in c-pragma.c on line 227
*/
{ DK_WARNING, DK_WARNING, DIAG_WARNING_BAD_PACK_ACTION,
NULL, 0, "bad-pack-action",
"unknown action '%s' for '#pragma pack' - ignored", NULL,
"The syntax is: \"#pragma pack (???)\" where \"???\" is:\n\
\"N\", \"push, N\", \"push, ID, N\", \"pop\", or \"pop, ID\"." },
/*
* Warning 107 defined in c-pragma.c on line 271
*/
{ DK_WARNING, DK_SUPPRESSED, DIAG_WARNING_PRAGMA_JUNK,
NULL, 0, "pragma-junk",
"junk at end of '#pragma %s'", NULL,
"No stray characters should appear after the pragma pack closing\n\
parenthesis." },
/*
* Warning 108 defined in c-pragma.c on line 292
*/
{ DK_WARNING, DK_WARNING, DIAG_WARNING_ALIGN_NOT_POWER_OF_2,
NULL, 0, "align-not-power-of-2",
"alignment must be a small power of two, not %d", NULL,
"You have your choice of: 0, 1, 2, 4, 8 or 16." },
/*
* Warning 109 defined in c-pragma.c on line 330
*/
{ DK_WARNING, DK_WARNING, DIAG_WARNING_WEAK_TOO_LATE,
NULL, 0, "weak-too-late",
"applying #pragma weak `%s' after first use results in unspecified behavior", NULL,
"We'll try to do it, but the results may not be what you expect." },
{ DK_SUPPRESSED /* no diagnostic 110 */ },
{ DK_SUPPRESSED /* no diagnostic 111 */ },
{ DK_SUPPRESSED /* no diagnostic 112 */ },
{ DK_SUPPRESSED /* no diagnostic 113 */ },
{ DK_SUPPRESSED /* no diagnostic 114 */ },
{ DK_SUPPRESSED /* no diagnostic 115 */ },
{ DK_SUPPRESSED /* no diagnostic 116 */ },
{ DK_SUPPRESSED /* no diagnostic 117 */ },
{ DK_SUPPRESSED /* no diagnostic 118 */ },
{ DK_SUPPRESSED /* no diagnostic 119 */ },
/*
* Warning 120 defined in c-pragma.c on line 439
*/
{ DK_WARNING, DK_WARNING, DIAG_WARNING_REDEFINE_CONFLICT,
NULL, 0, "redefine-conflict",
"#pragma redefine_extname conflicts with declaration", NULL,
"You will likely have unexpected results. Please change the\n\
name of your local declaration." },
/*
* Warning 121 defined in c-pragma.c on line 513
*/
{ DK_WARNING, DK_WARNING, DIAG_WARNING_RENAME_CONFLICT,
NULL, 0, "rename-conflict",
"asm declaration conficts with previous rename", NULL,
"You need to disambiguate them." },
/*
* Debug 122 defined in c-pragma.c on line 180
*/
{ DK_DEBUG, DK_DEBUG, DIAG_DEBUG_ENTER_HANDLE_PRAGMA_PACK,
NULL, 0, "enter-handle-pragma-pack",
"In file %s on line %d: We've entered the %s procedure", NULL,
"This is a tracing display." },
/*
* Ice 123 defined in expr.c on line 6201
*/
{ DK_ICE, DK_ICE, DIAG_ICE_UNSUPPORTED_WIDE_INT,
NULL, 0, "unsupported-wide-int",
"unsupported wide integer operation", NULL,
"The defined machine integer operation mode exceeds the\n\
capacity of the compiler." },
/*
* Error 124 defined in expr.c on line 6599
*/
{ DK_ERROR, DK_ERROR, DIAG_ERROR_PARAM_SIZE_DEPENDENCY,
NULL, 0, "param-size-dependency",
"prior parameter's size depends on `%s'", NULL,
"I'm unsure of what this means." }
};
/*
* Preamble strings for the kinds of diagnostics
*/
static const char *const diagnostic_kind_text[] = {
"fatal error: ",
"internal compiler error: ",
"sorry, unimplemented: ",
"error: ",
"warning: ",
"anacronism: ",
"note: ",
"debug: ",
"must-not-happen: "
};
#endif /* DEFINE_DIAGNOSTICS */
#endif /* GCC_DIAG_MACROS_H_GUARD */
--- c-pragma.c.ori Sat Jan 25 09:25:01 2003
+++ c-pragma.c Sun Jan 26 10:48:30 2003
@@ -35,9 +35,6 @@
#include "output.h"
#include "tm_p.h"
-#define GCC_BAD(msgid) do { warning (msgid); return; } while (0)
-#define GCC_BAD2(msgid, arg) do { warning (msgid, arg); return; } while (0)
-
typedef struct align_stack GTY(())
{
int alignment;
@@ -106,9 +103,13 @@
if (alignment_stack == NULL)
{
- warning ("\
-#pragma pack (pop) encountered without matching #pragma pack (push, <n>)"
- );
+ /*=diag unpushed_pop
+ * lev: warning
+ * fmt: "#pragma pack (pop) encountered without matching "
+ * "#pragma pack (push, <n>)"
+ * doc: These must match up. You may find unifdef(1BSD) useful.
+ =*/
+ WARNING_UNPUSHED_POP;
return;
}
@@ -124,9 +125,14 @@
break;
}
if (entry == NULL)
- warning ("\
-#pragma pack(pop, %s) encountered without matching #pragma pack(push, %s, <n>)"
- , IDENTIFIER_POINTER (id), IDENTIFIER_POINTER (id));
+ /*=diag unpushed_pop_id
+ * lev: warning
+ * fmt: "#pragma pack(pop, %s) encountered without"
+ * " matching #pragma pack(push, %s, <n>)"
+ * doc: These must match up. You may find unifdef(1BSD) useful.
+ =*/
+ WARNING_UNPUSHED_POP_ID(IDENTIFIER_POINTER (id),
+ IDENTIFIER_POINTER (id));
}
if (-- alignment_stack->num_pushes == 0)
@@ -143,10 +149,16 @@
}
#else /* not HANDLE_PRAGMA_PACK_PUSH_POP */
#define SET_GLOBAL_ALIGNMENT(ALIGN) (maximum_field_alignment = (ALIGN))
-#define push_alignment(ID, N) \
- GCC_BAD("#pragma pack(push[, id], <n>) is not supported on this target")
-#define pop_alignment(ID) \
- GCC_BAD("#pragma pack(pop[, id], <n>) is not supported on this target")
+/*=diag no_pragma_push_pop
+ * lev: warning
+ * fmt: #pragma pack(%s[, id], <n>) is not supported on this target
+ * doc: If you have a choice about the data structure, then reorder
+ * the items so they are always aligned consistently. Otherwise,
+ * you need to study the default layout and make sure that if you
+ * move the data to another machine that it is consistent.
+=*/
+#define push_alignment(ID, N) WARNING_NO_PRAGMA_PUSH_POP("push")
+#define pop_alignment(ID) WARNING_NO_PRAGMA_PUSH_POP("pop")
#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
/* #pragma pack ()
@@ -165,8 +177,21 @@
enum cpp_ttype token;
enum { set, push, pop } action;
+ /*=diag enter_handle_pragma_pack
+ * lev: debug
+ * fmt: "We've entered the %s procedure"
+ * doc: This is a tracing display.
+ =*/
+ DEBUG_ENTER_HANDLE_PRAGMA_PACK( __FUNCTION__ );
+
if (c_lex (&x) != CPP_OPEN_PAREN)
- GCC_BAD ("missing '(' after '#pragma pack' - ignored");
+ /*=diag pragma_pack_syntax
+ * lev: warning
+ * fmt: missing '(' after '#pragma pack' - ignored
+ * doc: The syntax is: "#pragma pack (???)" where "???" is:
+ * "N", "push, N", "push, ID, N", "pop", or "pop, ID".
+ =*/
+ WARNING_PRAGMA_PACK_SYNTAX;
token = c_lex (&x);
if (token == CPP_CLOSE_PAREN)
@@ -179,15 +204,19 @@
align = TREE_INT_CST_LOW (x);
action = set;
if (c_lex (&x) != CPP_CLOSE_PAREN)
- GCC_BAD ("malformed '#pragma pack' - ignored");
+ /*=diag malformed_pragma
+ * lev: warning
+ * fmt: malformed '#pragma %s' - ignored
+ * doc: The syntax is: "#pragma pack (???)" where "???" is:
+ * "N", "push, N", "push, ID, N", "pop", or "pop, ID".
+ =*/
+ WARNING_MALFORMED_PRAGMA("pack");
}
else if (token == CPP_NAME)
{
-#define GCC_BAD_ACTION do { if (action == push) \
- GCC_BAD ("malformed '#pragma pack(push[, id], <n>)' - ignored"); \
- else \
- GCC_BAD ("malformed '#pragma pack(pop[, id])' - ignored"); \
- } while (0)
+ static const char z_bad_push[] = "pack(push[, id], <n>)";
+ static const char z_bad_pop[] = "pack(pop[, id])";
+ WARNING_MALFORMED_PRAGMA((action == push) ? z_bad_push : z_bad_pop)
const char *op = IDENTIFIER_POINTER (x);
if (!strcmp (op, "push"))
@@ -195,11 +224,17 @@
else if (!strcmp (op, "pop"))
action = pop;
else
- GCC_BAD2 ("unknown action '%s' for '#pragma pack' - ignored", op);
+ /*=diag bad_pack_action
+ * lev: warning
+ * fmt: unknown action '%s' for '#pragma pack' - ignored
+ * doc: The syntax is: "#pragma pack (???)" where "???" is:
+ * "N", "push, N", "push, ID, N", "pop", or "pop, ID".
+ =*/
+ WARNING_BAD_PACK_ACTION(op);
token = c_lex (&x);
if (token != CPP_COMMA && action == push)
- GCC_BAD_ACTION;
+ WARNING_MALFORMED_PRAGMA((action == push) ? z_bad_push : z_bad_pop);
if (token == CPP_COMMA)
{
@@ -208,7 +243,8 @@
{
id = x;
if (action == push && c_lex (&x) != CPP_COMMA)
- GCC_BAD_ACTION;
+ WARNING_MALFORMED_PRAGMA((action == push) ?
+ z_bad_push : z_bad_pop);
token = c_lex (&x);
}
@@ -220,19 +256,26 @@
token = c_lex (&x);
}
else
- GCC_BAD_ACTION;
+ WARNING_MALFORMED_PRAGMA((action == push) ?
+ z_bad_push : z_bad_pop);
}
}
if (token != CPP_CLOSE_PAREN)
- GCC_BAD_ACTION;
-#undef GCC_BAD_ACTION
+ WARNING_MALFORMED_PRAGMA((action == push) ? z_bad_push : z_bad_pop);
}
else
- GCC_BAD ("malformed '#pragma pack' - ignored");
+ WARNING_MALFORMED_PRAGMA("pack");
if (c_lex (&x) != CPP_EOF)
- warning ("junk at end of '#pragma pack'");
+ /*=diag pragma_junk
+ * lev: warning
+ * disable:
+ * fmt: junk at end of '#pragma %s'
+ * doc: No stray characters should appear after the pragma pack closing
+ * parenthesis.
+ =*/
+ WARNING_PRAGMA_JUNK("pack");
if (action != pop)
switch (align)
@@ -246,7 +289,12 @@
align *= BITS_PER_UNIT;
break;
default:
- GCC_BAD2 ("alignment must be a small power of two, not %d", align);
+ /*=diag align_not_power_of_2
+ * lev: warning
+ * fmt: alignment must be a small power of two, not %d
+ * doc: You have your choice of: 0, 1, 2, 4, 8 or 16.
+ =*/
+ WARNING_ALIGN_NOT_POWER_OF_2(align);
}
switch (action)
@@ -279,7 +327,14 @@
if (SUPPORTS_WEAK && DECL_EXTERNAL (decl) && TREE_USED (decl)
&& TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
- warning_with_decl (decl, "applying #pragma weak `%s' after first use results in unspecified behavior");
+ /*=diag weak_too_late
+ * lev: warning
+ * decl:
+ * fmt: "applying #pragma weak `%s' after first use"
+ * " results in unspecified behavior"
+ * doc: We'll try to do it, but the results may not be what you expect.
+ =*/
+ WARNING_WEAK_TOO_LATE(decl);
declare_weak (decl);
}
@@ -320,16 +375,16 @@
value = 0;
if (c_lex (&name) != CPP_NAME)
- GCC_BAD ("malformed #pragma weak, ignored");
+ WARNING_MALFORMED_PRAGMA("weak");
t = c_lex (&x);
if (t == CPP_EQ)
{
if (c_lex (&value) != CPP_NAME)
- GCC_BAD ("malformed #pragma weak, ignored");
+ WARNING_MALFORMED_PRAGMA("weak");
t = c_lex (&x);
}
if (t != CPP_EOF)
- warning ("junk at end of #pragma weak");
+ WARNING_PRAGMA_JUNK("weak");
decl = identifier_global_value (name);
if (decl && TREE_CODE_CLASS (TREE_CODE (decl)) == 'd')
@@ -364,24 +419,30 @@
if (c_lex (&oldname) != CPP_NAME)
{
- warning ("malformed #pragma redefine_extname, ignored");
+ WARNING_MALFORMED_PRAGMA("redefine_extname");
return;
}
if (c_lex (&newname) != CPP_NAME)
{
- warning ("malformed #pragma redefine_extname, ignored");
+ WARNING_MALFORMED_PRAGMA("redefine_extname");
return;
}
t = c_lex (&x);
if (t != CPP_EOF)
- warning ("junk at end of #pragma redefine_extname");
+ WARNING_PRAGMA_JUNK("redefine_extname");
decl = identifier_global_value (oldname);
if (decl && TREE_CODE_CLASS (TREE_CODE (decl)) == 'd')
{
if (DECL_ASSEMBLER_NAME_SET_P (decl)
&& DECL_ASSEMBLER_NAME (decl) != newname)
- warning ("#pragma redefine_extname conflicts with declaration");
+ /*=diag redefine_conflict
+ * lev: warning
+ * fmt: #pragma redefine_extname conflicts with declaration
+ * doc: You will likely have unexpected results. Please change the
+ * name of your local declaration.
+ =*/
+ WARNING_REDEFINE_CONFLICT;
SET_DECL_ASSEMBLER_NAME (decl, newname);
}
else
@@ -412,12 +473,12 @@
if (c_lex (&prefix) != CPP_STRING)
{
- warning ("malformed #pragma extern_prefix, ignored");
+ WARNING_MALFORMED_PRAGMA("extern_prefix");
return;
}
t = c_lex (&x);
if (t != CPP_EOF)
- warning ("junk at end of #pragma extern_prefix");
+ WARNING_PRAGMA_JUNK("extern_prefix");
/* Note that the length includes the null terminator. */
pragma_extern_prefix = (TREE_STRING_LENGTH (prefix) > 1 ? prefix : NULL);
@@ -449,7 +510,12 @@
{
const char *oldasmname = IDENTIFIER_POINTER (oldname) + 1;
if (asmname && strcmp (TREE_STRING_POINTER (asmname), oldasmname) != 0)
- warning ("asm declaration conficts with previous rename");
+ /*=diag rename_conflict
+ * lev: warning
+ * fmt: asm declaration conficts with previous rename
+ * doc: You need to disambiguate them.
+ =*/
+ WARNING_RENAME_CONFLICT;
asmname = build_string (strlen (oldasmname), oldasmname);
}
@@ -462,7 +528,7 @@
const char *newname = IDENTIFIER_POINTER (TREE_VALUE (t));
if (asmname && strcmp (TREE_STRING_POINTER (asmname), newname) != 0)
- warning ("#pragma redefine_extname conflicts with declaration");
+ WARNING_REDEFINE_CONFLICT;
*p = TREE_CHAIN (t);
return build_string (strlen (newname), newname);
--- expr.c.ori Sun Jan 26 09:27:23 2003
+++ expr.c Sun Jan 26 12:10:09 2003
@@ -6198,7 +6198,13 @@
mode = TYPE_MODE (TREE_TYPE (exp));
if (GET_MODE_CLASS (mode) == MODE_INT
&& mode > MAX_INTEGER_COMPUTATION_MODE)
- internal_error ("unsupported wide integer operation");
+ /*=diag unsupported_wide_int
+ * lev: ice
+ * fmt: unsupported wide integer operation
+ * doc: The defined machine integer operation mode exceeds the
+ * capacity of the compiler.
+ =*/
+ ICE_UNSUPPORTED_WIDE_INT;
}
/* Check operand of a unary op. */
@@ -6207,7 +6213,7 @@
mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
if (GET_MODE_CLASS (mode) == MODE_INT
&& mode > MAX_INTEGER_COMPUTATION_MODE)
- internal_error ("unsupported wide integer operation");
+ ICE_UNSUPPORTED_WIDE_INT;
}
/* Check operands of a binary/comparison op. */
@@ -6216,12 +6222,12 @@
mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
if (GET_MODE_CLASS (mode) == MODE_INT
&& mode > MAX_INTEGER_COMPUTATION_MODE)
- internal_error ("unsupported wide integer operation");
+ ICE_UNSUPPORTED_WIDE_INT;
mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 1)));
if (GET_MODE_CLASS (mode) == MODE_INT
&& mode > MAX_INTEGER_COMPUTATION_MODE)
- internal_error ("unsupported wide integer operation");
+ ICE_UNSUPPORTED_WIDE_INT;
}
}
#endif
@@ -6523,7 +6529,7 @@
if (GET_MODE_CLASS (mode) == MODE_INT
&& mode > MAX_INTEGER_COMPUTATION_MODE)
- internal_error ("unsupported wide integer operation");
+ ICE_UNSUPPORTED_WIDE_INT;
}
if (tmode != mode
@@ -6539,7 +6545,7 @@
&& TREE_CODE (exp) != RTL_EXPR
&& GET_MODE_CLASS (tmode) == MODE_INT
&& tmode > MAX_INTEGER_COMPUTATION_MODE)
- internal_error ("unsupported wide integer operation");
+ ICE_UNSUPPORTED_WIDE_INT;
check_max_integer_computation_mode (exp);
#endif
@@ -6590,7 +6596,13 @@
case PARM_DECL:
if (!DECL_RTL_SET_P (exp))
{
- error_with_decl (exp, "prior parameter's size depends on `%s'");
+ /*=diag param_size_dependency
+ * lev: error
+ * decl:
+ * fmt: prior parameter's size depends on `%s'
+ * doc: I'm unsure of what this means.
+ =*/
+ ERROR_PARAM_SIZE_DEPENDENCY(exp);
return CONST0_RTX (mode);
}