This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]: Add some java format attributes
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Date: Sun, 29 May 2005 09:51:27 -0400 (EDT)
- Subject: [PATCH]: Add some java format attributes
This patch adds some format attributes to the java directory.
Bootstrapped on x86_64-unknown-linux-gnu, no regressions.
Okay for mainline?
Thanks,
--Kaveh
2005-05-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gjavah.c (error): Add ATTRIBUTE_PRINTF_1.
* java-tree.h (parse_error_context): Move...
* parse.h (parse_error_context): ... here, add ATTRIBUTE_GCC_DIAG.
* parse.y (parse_warning_context): Add ATTRIBUTE_GCC_DIAG.
* verify-impl.c (debug_print): Add ATTRIBUTE_PRINTF_1.
diff -rup orig/egcc-CVS20050526/gcc/java/gjavah.c egcc-CVS20050526/gcc/java/gjavah.c
--- orig/egcc-CVS20050526/gcc/java/gjavah.c 2005-05-04 22:01:41.000000000 -0400
+++ egcc-CVS20050526/gcc/java/gjavah.c 2005-05-27 10:09:04.000000000 -0400
@@ -164,7 +164,7 @@ static const unsigned char *
decode_signature_piece (FILE *, const unsigned char *,
const unsigned char *, int *);
static void print_class_decls (FILE *, JCF *, int);
-static void error (const char *msgid, ...);
+static void error (const char *msgid, ...) ATTRIBUTE_PRINTF_1;
static void usage (void) ATTRIBUTE_NORETURN;
static void help (void) ATTRIBUTE_NORETURN;
static void version (void) ATTRIBUTE_NORETURN;
diff -rup orig/egcc-CVS20050526/gcc/java/java-tree.h egcc-CVS20050526/gcc/java/java-tree.h
--- orig/egcc-CVS20050526/gcc/java/java-tree.h 2005-05-26 00:33:10.000000000 -0400
+++ egcc-CVS20050526/gcc/java/java-tree.h 2005-05-27 10:09:04.000000000 -0400
@@ -1305,7 +1305,6 @@ extern tree emit_symbol_table (tree, tre
extern void lang_init_source (int);
extern void write_classfile (tree);
extern char *print_int_node (tree);
-extern void parse_error_context (tree cl, const char *msgid, ...);
extern void finish_class (void);
extern void java_layout_seen_class_methods (void);
extern void check_for_initialization (tree, tree);
diff -rup orig/egcc-CVS20050526/gcc/java/parse.h egcc-CVS20050526/gcc/java/parse.h
--- orig/egcc-CVS20050526/gcc/java/parse.h 2005-05-10 21:25:37.000000000 -0400
+++ egcc-CVS20050526/gcc/java/parse.h 2005-05-27 10:09:04.000000000 -0400
@@ -120,6 +120,10 @@ extern tree stabilize_reference (tree);
}
#endif
+#ifdef ATTRIBUTE_GCC_DIAG
+extern void parse_error_context (tree cl, const char *msgid, ...) ATTRIBUTE_GCC_DIAG(2,3);
+#endif
+
#define ABSTRACT_CHECK(FLAG, V, CL, S) \
if ((FLAG) & (V)) \
parse_error_context ((CL), "%s method can't be abstract", (S));
diff -rup orig/egcc-CVS20050526/gcc/java/parse.y egcc-CVS20050526/gcc/java/parse.y
--- orig/egcc-CVS20050526/gcc/java/parse.y 2005-05-24 22:01:32.000000000 -0400
+++ egcc-CVS20050526/gcc/java/parse.y 2005-05-27 10:09:04.000000000 -0400
@@ -96,7 +96,7 @@ static tree lookup_java_method2 (tree, t
static tree method_header (int, tree, tree, tree);
static void fix_method_argument_names (tree ,tree);
static tree method_declarator (tree, tree);
-static void parse_warning_context (tree cl, const char *msgid, ...);
+static void parse_warning_context (tree cl, const char *msgid, ...) ATTRIBUTE_GCC_DIAG(2,3);
#ifdef USE_MAPPED_LOCATION
static void issue_warning_error_from_context
(source_location, const char *msgid, va_list *);
diff -rup orig/egcc-CVS20050526/gcc/java/verify-impl.c egcc-CVS20050526/gcc/java/verify-impl.c
--- orig/egcc-CVS20050526/gcc/java/verify-impl.c 2005-03-07 19:11:21.000000000 -0500
+++ egcc-CVS20050526/gcc/java/verify-impl.c 2005-05-27 12:47:54.000000000 -0400
@@ -26,21 +26,16 @@ details. */
verification. */
#define INVALID_STATE ((state *) -1)
-#ifdef VERIFY_DEBUG
-static void
-debug_print (const char *fmt, ...)
+static void ATTRIBUTE_PRINTF_1
+debug_print (const char *fmt ATTRIBUTE_UNUSED, ...)
{
+#ifdef VERIFY_DEBUG
va_list ap;
va_start (ap, fmt);
vfprintf (stderr, fmt, ap);
va_end (ap);
-}
-#else
-static void
-debug_print (const char *fmt ATTRIBUTE_UNUSED, ...)
-{
-}
#endif /* VERIFY_DEBUG */
+}
/* This started as a fairly ordinary verifier, and for the most part
it remains so. It works in the obvious way, by modeling the effect