summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2003-03-17 22:57:27 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2003-03-17 22:57:27 +0000
commitd41c4351fecd21f7602c66ac78c594557b87f5c4 (patch)
treef8eebb237a7df33aff85f0a6d32405d2ea65a589
parent6970c06a4e8f9ff3524043bf64b51c6870693bc7 (diff)
downloadgcc-d41c4351fecd21f7602c66ac78c594557b87f5c4.tar.gz
ansidecl.h (ATTRIBUTE_NONNULL, [...]): New.
include: * ansidecl.h (ATTRIBUTE_NONNULL, ATTRIBUTE_NULL_PRINTF, ATTRIBUTE_NULL_PRINTF_1, ATTRIBUTE_NULL_PRINTF_2, ATTRIBUTE_NULL_PRINTF_3, ATTRIBUTE_NULL_PRINTF_4, ATTRIBUTE_NULL_PRINTF_5): New. (ATTRIBUTE_PRINTF): Add ATTRIBUTE_NONNULL. gcc: * dwarf2asm.h: Delete obsolete comment. (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_encoded_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128): Add ATTRIBUTE_NULL_PRINTF. From-SVN: r64505
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/dwarf2asm.h28
-rw-r--r--include/ChangeLog8
-rw-r--r--include/ansidecl.h30
4 files changed, 59 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e9702e5dca7..26daccd8f19 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2003-03-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * dwarf2asm.h: Delete obsolete comment.
+ (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset,
+ dw2_asm_output_pcrel, dw2_asm_output_addr,
+ dw2_asm_output_addr_rtx, dw2_asm_output_encoded_addr_rtx,
+ dw2_asm_output_nstring, dw2_asm_output_data_uleb128,
+ dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128,
+ dw2_asm_output_delta_sleb128): Add ATTRIBUTE_NULL_PRINTF.
+
2003-03-17 Zack Weinberg <zack@codesourcery.com>
* c-tree.h (struct lang_identifier): Remove error_locus field.
diff --git a/gcc/dwarf2asm.h b/gcc/dwarf2asm.h
index 859883d45e3..8d6fd18bd89 100644
--- a/gcc/dwarf2asm.h
+++ b/gcc/dwarf2asm.h
@@ -19,60 +19,56 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-/* ??? Format checking yields "null format string" warnings, which is
- the way these routines are signaled that there is no associated
- debug information. So the attributes are commented out. */
-
extern void dw2_assemble_integer PARAMS ((int, rtx));
extern void dw2_asm_output_data PARAMS ((int, unsigned HOST_WIDE_INT,
const char *, ...))
- /* ATTRIBUTE_PRINTF_3 */;
+ ATTRIBUTE_NULL_PRINTF_3;
extern void dw2_asm_output_delta PARAMS ((int, const char *,
const char *,
const char *, ...))
- /* ATTRIBUTE_PRINTF_4 */;
+ ATTRIBUTE_NULL_PRINTF_4;
extern void dw2_asm_output_offset PARAMS ((int, const char *,
const char *, ...))
- /* ATTRIBUTE_PRINTF_3 */;
+ ATTRIBUTE_NULL_PRINTF_3;
extern void dw2_asm_output_pcrel PARAMS ((int, const char *,
const char *, ...))
- /* ATTRIBUTE_PRINTF_3 */;
+ ATTRIBUTE_NULL_PRINTF_3;
extern void dw2_asm_output_addr PARAMS ((int, const char *,
const char *, ...))
- /* ATTRIBUTE_PRINTF_3 */;
+ ATTRIBUTE_NULL_PRINTF_3;
extern void dw2_asm_output_addr_rtx PARAMS ((int, rtx,
const char *, ...))
- /* ATTRIBUTE_PRINTF_3 */;
+ ATTRIBUTE_NULL_PRINTF_3;
extern void dw2_asm_output_encoded_addr_rtx PARAMS ((int, rtx,
const char *, ...))
- /* ATTRIBUTE_PRINTF_3 */;
+ ATTRIBUTE_NULL_PRINTF_3;
extern void dw2_asm_output_nstring PARAMS ((const char *, size_t,
const char *, ...))
- /* ATTRIBUTE_PRINTF_3 */;
+ ATTRIBUTE_NULL_PRINTF_3;
extern void dw2_asm_output_data_uleb128 PARAMS ((unsigned HOST_WIDE_INT,
const char *, ...))
- /* ATTRIBUTE_PRINTF_2 */;
+ ATTRIBUTE_NULL_PRINTF_2;
extern void dw2_asm_output_data_sleb128 PARAMS ((HOST_WIDE_INT,
const char *, ...))
- /* ATTRIBUTE_PRINTF_2 */;
+ ATTRIBUTE_NULL_PRINTF_2;
extern void dw2_asm_output_delta_uleb128 PARAMS ((const char *, const char *,
const char *, ...))
- /* ATTRIBUTE_PRINTF_3 */;
+ ATTRIBUTE_NULL_PRINTF_3;
extern void dw2_asm_output_delta_sleb128 PARAMS ((const char *, const char *,
const char *, ...))
- /* ATTRIBUTE_PRINTF_3 */;
+ ATTRIBUTE_NULL_PRINTF_3;
extern int size_of_uleb128 PARAMS ((unsigned HOST_WIDE_INT));
extern int size_of_sleb128 PARAMS ((HOST_WIDE_INT));
diff --git a/include/ChangeLog b/include/ChangeLog
index 241529c35d9..51d2fc2158b 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,11 @@
+2003-03-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * ansidecl.h (ATTRIBUTE_NONNULL, ATTRIBUTE_NULL_PRINTF,
+ ATTRIBUTE_NULL_PRINTF_1, ATTRIBUTE_NULL_PRINTF_2,
+ ATTRIBUTE_NULL_PRINTF_3, ATTRIBUTE_NULL_PRINTF_4,
+ ATTRIBUTE_NULL_PRINTF_5): New.
+ (ATTRIBUTE_PRINTF): Add ATTRIBUTE_NONNULL.
+
2003-03-17 Jan Hubicka <jh@suse.cz>
* hashtab.h (htab_traverse_noresize): Declare.
diff --git a/include/ansidecl.h b/include/ansidecl.h
index d169b4f50ed..f8f2d737bf0 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -268,8 +268,21 @@ So instead we use the macro below and test it against specific values. */
#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
#endif /* ATTRIBUTE_NORETURN */
+/* Attribute `nonnull' was valid as of gcc 3.3. */
+#ifndef ATTRIBUTE_NONNULL
+# if (GCC_VERSION >= 3003)
+# define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
+# else
+# define ATTRIBUTE_NONNULL(m)
+# endif /* GNUC >= 3.3 */
+#endif /* ATTRIBUTE_NONNULL */
+
+/* Use ATTRIBUTE_PRINTF when the format specifier must not be NULL.
+ This was the case for the `printf' format attribute by itself
+ before GCC 3.3, but as of 3.3 we need to add the `nonnull'
+ attribute to retain this behavior. */
#ifndef ATTRIBUTE_PRINTF
-#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
+#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m)
#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
@@ -277,6 +290,21 @@ So instead we use the macro below and test it against specific values. */
#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
#endif /* ATTRIBUTE_PRINTF */
+/* Use ATTRIBUTE_NULL_PRINTF when the format specifier may be NULL. A
+ NULL format specifier was allowed as of gcc 3.3. */
+#ifndef ATTRIBUTE_NULL_PRINTF
+# if (GCC_VERSION >= 3003)
+# define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
+# else
+# define ATTRIBUTE_NULL_PRINTF(m, n)
+# endif /* GNUC >= 3.3 */
+# define ATTRIBUTE_NULL_PRINTF_1 ATTRIBUTE_NULL_PRINTF(1, 2)
+# define ATTRIBUTE_NULL_PRINTF_2 ATTRIBUTE_NULL_PRINTF(2, 3)
+# define ATTRIBUTE_NULL_PRINTF_3 ATTRIBUTE_NULL_PRINTF(3, 4)
+# define ATTRIBUTE_NULL_PRINTF_4 ATTRIBUTE_NULL_PRINTF(4, 5)
+# define ATTRIBUTE_NULL_PRINTF_5 ATTRIBUTE_NULL_PRINTF(5, 6)
+#endif /* ATTRIBUTE_NULL_PRINTF */
+
/* We use __extension__ in some places to suppress -pedantic warnings
about GCC extensions. This feature didn't work properly before
gcc 2.8. */