parse.h (OBSOLETE_MODIFIER_WARNING): Don't use ANSI string concatenation.

* parse.h (OBSOLETE_MODIFIER_WARNING): Don't use ANSI string
	concatenation.
	(OBSOLETE_MODIFIER_WARNING2): New macro allowing two args.

	* parse.y (register_fields): Don't pass a format specifier to
	OBSOLETE_MODIFIER_WARNING.
	(check_abstract_method_header): Use OBSOLETE_MODIFIER_WARNING2
	instead of OBSOLETE_MODIFIER_WARNING, and don't pass a format
	specifier.
	(check_modifiers): Change function into a macro.
	(check_class_interface_creation): Pass a literal format string.

From-SVN: r31614
This commit is contained in:
Kaveh R. Ghazi 2000-01-25 18:29:02 +00:00 committed by Kaveh Ghazi
parent 8c135f8458
commit 2884c41e1c
4 changed files with 2417 additions and 2390 deletions

View File

@ -1,3 +1,17 @@
2000-01-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* parse.h (OBSOLETE_MODIFIER_WARNING): Don't use ANSI string
concatenation.
(OBSOLETE_MODIFIER_WARNING2): New macro allowing two args.
* parse.y (register_fields): Don't pass a format specifier to
OBSOLETE_MODIFIER_WARNING.
(check_abstract_method_header): Use OBSOLETE_MODIFIER_WARNING2
instead of OBSOLETE_MODIFIER_WARNING, and don't pass a format
specifier.
(check_modifiers): Change function into a macro.
(check_class_interface_creation): Pass a literal format string.
2000-01-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* buffer.h: PROTO -> PARAMS.

File diff suppressed because it is too large Load Diff

View File

@ -138,13 +138,20 @@ extern tree stabilize_reference PARAMS ((tree));
/* Pedantic warning on obsolete modifiers. Note: when cl is NULL,
flags was set artificially, such as for a interface method */
#define OBSOLETE_MODIFIER_WARNING(cl, flags, __modifier, format, arg) \
#define OBSOLETE_MODIFIER_WARNING(cl, flags, __modifier, arg) \
{ \
if (flag_redundant && (cl) && ((flags) & (__modifier))) \
parse_warning_context (cl, \
"Discouraged redundant use of `%s' modifier in declaration of " format, \
"Discouraged redundant use of `%s' modifier in declaration of %s", \
java_accstring_lookup (__modifier), arg); \
}
#define OBSOLETE_MODIFIER_WARNING2(cl, flags, __modifier, arg1, arg2) \
{ \
if (flag_redundant && (cl) && ((flags) & (__modifier))) \
parse_warning_context (cl, \
"Discouraged redundant use of `%s' modifier in declaration of %s `%s'", \
java_accstring_lookup (__modifier), arg1, arg2);\
}
/* Quickly build a temporary pointer on hypothetical type NAME. */
#define BUILD_PTR_FROM_NAME(ptr, name) \

View File

@ -70,7 +70,6 @@ definitions and other extensions. */
static char *java_accstring_lookup PARAMS ((int));
static void classitf_redefinition_error PARAMS ((const char *,tree, tree, tree));
static void variable_redefinition_error PARAMS ((tree, tree, tree, int));
static void check_modifiers PARAMS ((const char *, int, int));
static tree create_class PARAMS ((int, tree, tree, tree));
static tree create_interface PARAMS ((int, tree, tree));
static tree find_field PARAMS ((tree, tree));
@ -325,6 +324,22 @@ static tree current_static_block = NULL_TREE;
/* The list of all packages we've seen so far */
static tree package_list = NULL_TREE;
/* Check modifiers. If one doesn't fit, retrieve it in its declaration
line and point it out. */
/* Should point out the one that don't fit. ASCII/unicode, going
backward. FIXME */
#define check_modifiers(__message, __value, __mask) do { \
if ((__value) & ~(__mask)) \
{ \
int i, remainder = (__value) & ~(__mask); \
for (i = 0; i <= 10; i++) \
if ((1 << i) & remainder) \
parse_error_context (ctxp->modifier_ctx [i], (__message), \
java_accstring_lookup (1 << i)); \
} \
} while (0)
%}
@ -2882,27 +2897,6 @@ build_unresolved_array_type (type_or_wfl)
EXPR_WFL_COLNO (type_or_wfl));
}
/* Check modifiers. If one doesn't fit, retrieve it in its declaration line
and point it out. */
static void
check_modifiers (message, value, mask)
const char *message;
int value;
int mask;
{
/* Should point out the one that don't fit. ASCII/unicode,
going backward. FIXME */
if (value & ~mask)
{
int i, remainder = value & ~mask;
for (i = 0; i <= 10; i++)
if ((1 << i) & remainder)
parse_error_context (ctxp->modifier_ctx [i], message,
java_accstring_lookup (1 << i));
}
}
static void
parser_add_interface (class_decl, interface_decl, wfl)
tree class_decl, interface_decl, wfl;
@ -2967,10 +2961,12 @@ check_class_interface_creation (is_interface, flags, raw_name, qualified_name, d
IDENTIFIER_POINTER (raw_name));
}
check_modifiers ((is_interface ?
"Illegal modifier `%s' for interface declaration" :
"Illegal modifier `%s' for class declaration"), flags,
(is_interface ? INTERFACE_MODIFIERS : CLASS_MODIFIERS));
if (is_interface)
check_modifiers ("Illegal modifier `%s' for interface declaration",
flags, INTERFACE_MODIFIERS);
else
check_modifiers ("Illegal modifier `%s' for class declaration",
flags, CLASS_MODIFIERS);
return 0;
}
@ -3239,13 +3235,11 @@ register_fields (flags, type, variable_list)
if (CLASS_INTERFACE (TYPE_NAME (class_type)))
{
OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK),
flags, ACC_PUBLIC,
"%s", "interface field(s)");
flags, ACC_PUBLIC, "interface field(s)");
OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK),
flags, ACC_STATIC,
"%s", "interface field(s)");
flags, ACC_STATIC, "interface field(s)");
OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK),
flags, ACC_FINAL, "%s", "interface field(s)");
flags, ACC_FINAL, "interface field(s)");
check_modifiers ("Illegal interface member modifier `%s'", flags,
INTERFACE_FIELD_MODIFIERS);
flags |= (ACC_PUBLIC | ACC_STATIC | ACC_FINAL);
@ -3754,12 +3748,12 @@ check_abstract_method_header (meth)
/* DECL_NAME might still be a WFL node */
tree name = GET_METHOD_NAME (meth);
OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (ABSTRACT_TK), flags,
ACC_ABSTRACT, "abstract method `%s'",
IDENTIFIER_POINTER (name));
OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK), flags,
ACC_PUBLIC, "abstract method `%s'",
IDENTIFIER_POINTER (name));
OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (ABSTRACT_TK), flags,
ACC_ABSTRACT, "abstract method",
IDENTIFIER_POINTER (name));
OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (PUBLIC_TK), flags,
ACC_PUBLIC, "abstract method",
IDENTIFIER_POINTER (name));
check_modifiers ("Illegal modifier `%s' for interface method",
flags, INTERFACE_METHOD_MODIFIERS);