aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/format
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2005-07-03 14:28:03 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2005-07-03 14:28:03 +0000
commit0ce0154c400c8ee912f32cf62164fbf88bfcfde3 (patch)
treefc2772efedbf66e55c9a9b40eaefe5699f7ff993 /gcc/testsuite/gcc.dg/format
parent4c5bc6f8191db75af2b024bc981562b0c0648ae2 (diff)
downloadgcc-0ce0154c400c8ee912f32cf62164fbf88bfcfde3.zip
gcc-0ce0154c400c8ee912f32cf62164fbf88bfcfde3.tar.gz
gcc-0ce0154c400c8ee912f32cf62164fbf88bfcfde3.tar.bz2
c-format.c (gcc_gfc_format_type, [...]): New.
* c-format.c (gcc_gfc_format_type, gcc_gfc_flag_pairs, gcc_gfc_char_table, init_dynamic_gfc_info): New. (format_types_orig, handle_format_attribute): Add support for format "gcc_gfc". fortran: * error.c (error_printf, error_print): Use ATTRIBUTE_GCC_GFC. * gfortran.h (ATTRIBUTE_GCC_GFC): New. (gfc_warning, gfc_warning_now, gfc_error, gfc_error_now, gfc_fatal_error, gfc_internal_error, gfc_notify_std): Use ATTRIBUTE_GCC_GFC. testsuite: * gcc.dg/format/gcc_gfc-1.c: New. From-SVN: r101552
Diffstat (limited to 'gcc/testsuite/gcc.dg/format')
-rw-r--r--gcc/testsuite/gcc.dg/format/gcc_gfc-1.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/format/gcc_gfc-1.c b/gcc/testsuite/gcc.dg/format/gcc_gfc-1.c
new file mode 100644
index 0000000..d23701d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/gcc_gfc-1.c
@@ -0,0 +1,30 @@
+/* Test for gcc_gfc formats. */
+/* Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+#include "format.h"
+
+/* Magic identifier must be set before the attribute is used. */
+typedef struct locus locus;
+
+extern int gfc_warn (const char *, ...) __attribute__ ((__format__ (__gcc_gfc__, 1, 2))) __attribute__ ((__nonnull__));
+
+void
+foo (int i, char *s, long int l, llong ll, locus *loc)
+{
+ /* Acceptable C90 specifiers, flags and modifiers. */
+ gfc_warn ("%%");
+ gfc_warn ("%d%i%c%s%%", i, i, i, s);
+
+ /* Extensions provided in gfc_warn. */
+ gfc_warn ("%C");
+ gfc_warn ("%L", loc);
+
+ /* Various tests of bad argument types. */
+ gfc_warn ("%d", l); /* { dg-warning "format" "bad argument types" } */
+ gfc_warn ("%d", ll); /* { dg-warning "format" "bad argument types" } */
+ gfc_warn ("%s", &i); /* { dg-warning "format" "bad argument types" } */
+ gfc_warn ("%L", &i); /* { dg-warning "format" "bad argument types" } */
+ gfc_warn ("%C", i); /* { dg-warning "format" "too many arguments" } */
+}