aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/cppexp.c9
-rw-r--r--gcc/cpplib.c2
-rw-r--r--gcc/cpptrad.c5
-rw-r--r--gcc/f/ChangeLog4
-rw-r--r--gcc/f/lang-specs.h2
-rw-r--r--gcc/gcc.c3
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.dg/cpp/assert_trad1.c46
-rw-r--r--gcc/testsuite/gcc.dg/cpp/assert_trad2.c24
-rw-r--r--gcc/testsuite/gcc.dg/cpp/assert_trad3.c10
-rw-r--r--gcc/testsuite/gcc.dg/cpp/defined_trad.c79
-rw-r--r--gcc/testsuite/gcc.dg/cpp/hash2.c15
-rw-r--r--gcc/testsuite/gcc.dg/cpp/tr-define.c2
-rw-r--r--gcc/testsuite/gcc.dg/cpp/tr-direct.c11
-rw-r--r--gcc/testsuite/gcc.dg/cpp/tr-sign.c18
-rw-r--r--gcc/testsuite/gcc.dg/cpp/tr-str.c17
-rw-r--r--gcc/testsuite/gcc.dg/cpp/uchar-2.c8
18 files changed, 35 insertions, 238 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 48ac782..f7b0f32 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2002-06-20 Neil Booth <neil@daikokuya.co.uk>
+
+ * cppexp.c (cpp_interpret_integer): Don't force traditional
+ numbers to be unsigned.
+ * cpplib.c (prepare_directive_trad): Set line number for
+ diagnostics.
+ * cpptrad.c (scan_out_logical_line): Continue scanning out
+ at start of buffer.
+ * gcc.c (trad_capable_cpp): Use cc1 always.
+
2002-06-20 Jeffrey Law <law@redhat.com>
* i386.h (TARGET_DEFAULT): Do not turn on frame pointer
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index 4fc833c..b3a7ce6 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -375,10 +375,13 @@ cpp_interpret_integer (pfile, token, type)
if (overflow)
cpp_error (pfile, DL_PEDWARN,
"integer constant is too large for its type");
- else if (!result.unsignedp && !num_positive (result, precision))
+ /* If too big to be signed, consider it unsigned. Only warn for
+ decimal numbers. Traditional numbers were always signed (but
+ we still honour an explicit U suffix). */
+ else if (!result.unsignedp
+ && !CPP_OPTION (pfile, traditional)
+ && !num_positive (result, precision))
{
- /* If too big to be signed, consider it unsigned. Only warn
- for decimal numbers. */
if (base == 10)
cpp_error (pfile, DL_WARNING,
"integer constant is so large that it is unsigned");
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index 4ee97e8..d3c95e7 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -303,6 +303,8 @@ prepare_directive_trad (pfile)
pfile->state.skipping = was_skipping;
_cpp_overlay_buffer (pfile, pfile->out.base,
pfile->out.cur - pfile->out.base);
+ /* Report diagnostics on the line of the directive. */
+ pfile->line = pfile->directive_line;
}
/* Stop ISO C from expanding anything. */
diff --git a/gcc/cpptrad.c b/gcc/cpptrad.c
index 82eeee5..74976db 100644
--- a/gcc/cpptrad.c
+++ b/gcc/cpptrad.c
@@ -38,7 +38,7 @@ struct block
};
#define BLOCK_HEADER_LEN offsetof (struct block, text)
-#define BLOCK_LEN(TEXT_LEN) CPP_ALIGN (BLOCK_HEADER_LEN + TEXT_LEN)
+#define BLOCK_LEN(TEXT_LEN) CPP_ALIGN (BLOCK_HEADER_LEN + (TEXT_LEN))
/* Structure holding information about a function-like macro
invocation. */
@@ -602,8 +602,9 @@ scan_out_logical_line (pfile, macro)
{
/* Found a parameter in the replacement text of a
#define. Remove its name from the output. */
- out = pfile->out.cur = out_start;
+ pfile->out.cur = out_start;
save_replacement_text (pfile, macro, node->arg_index);
+ out = pfile->out.base;
}
else if (lex_state == ls_hash)
{
diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog
index 581fbe1..fa3128c 100644
--- a/gcc/f/ChangeLog
+++ b/gcc/f/ChangeLog
@@ -1,3 +1,7 @@
+Thu Jun 20 21:56:34 2002 Neil Booth <neil@daikokuya.co.uk>
+
+ * lang-specs.h: Use cc1 for traditional preprocessing.
+
2002-06-20 Andreas Jaeger <aj@suse.de>
* com.c (ffecom_prepare_expr_,ffecom_expr_power_integer_):
diff --git a/gcc/f/lang-specs.h b/gcc/f/lang-specs.h
index c22837a..5536f78 100644
--- a/gcc/f/lang-specs.h
+++ b/gcc/f/lang-specs.h
@@ -28,7 +28,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
{".fpp", "@f77-cpp-input", 0},
{".FPP", "@f77-cpp-input", 0},
{"@f77-cpp-input",
- "tradcpp0 -lang-fortran %(cpp_options) \
+ "cc1 -E -traditional-cpp -D_LANGUAGE_FORTRAN %(cpp_options) \
%{E|M|MM:%(cpp_debug_options)}\
%{!M:%{!MM:%{!E:%{!pipe:%g.f} |\n\
f771 %{!pipe:%g.f} %(cc1_options) %{I*} %{!fsyntax-only:%(invoke_as)}}}}", 0},
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 292b061..fc0f359 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -675,8 +675,7 @@ static const char *startfile_prefix_spec = STARTFILE_PREFIX_SPEC;
call cc1 (or cc1obj in objc/lang-specs.h) from the main specs so
that we default the front end language better. */
static const char *trad_capable_cpp =
-"%{traditional|ftraditional|traditional-cpp:tradcpp0}\
- %{!traditional:%{!ftraditional:%{!traditional-cpp:cc1 -E}}}";
+"cc1 -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}";
static const char *cpp_unique_options =
"%{C:%{!E:%eGNU C does not support -C without using -E}}\
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 653cab3..498e671 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2002-06-20 Neil Booth <neil@daikokuya.co.uk>
+
+ * gcc.dg/cpp/assert_trad1.c, gcc.dg/cpp/assert_trad2.c,
+ gcc.dg/cpp/assert_trad3.c, gcc.dg/cpp/defined_trad.c,
+ gcc.dg/cpp/hash2.c, gcc.dg/cpp/tr-define.c, gcc.dg/cpp/tr-direct.c,
+ gcc.dg/cpp/tr-sign.c, gcc.dg/cpp/tr-str.c, gcc.dg/cpp/uchar-2.c:
+ Remove.
+
2002-06-20 Richard Sandiford <rsandifo@redhat.com>
* gcc.dg/20020620-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/cpp/assert_trad1.c b/gcc/testsuite/gcc.dg/cpp/assert_trad1.c
deleted file mode 100644
index 6d3c04e..0000000
--- a/gcc/testsuite/gcc.dg/cpp/assert_trad1.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Basic tests of the #assert preprocessor extension. */
-/* { dg-do compile } */
-/* { dg-options "-traditional-cpp" } */
-
-/* #define def unused expansion */ /* tradcpp can't handle macros in answers. */
-#define fail int failit
-
-#assert abc (def)
-#assert abc (ghi)
-#assert abc (jkl)
-#assert space ( s p a c e )
-
-/* Basic: */
-#if !#abc (def) || !#abc (ghi) || !#abc (jkl)
-fail
-#endif
-
-/* any answer for #abc */
-#if !#abc
-fail
-#endif
-
-/* internal whitespace is collapsed,
- external whitespace is deleted */
-#if !#space (s p a c e) || !#space ( s p a c e ) || #space (space)
-fail
-#endif
-
-/* removing assertions */
-#unassert abc (jkl)
-#if !#abc || !#abc (def) || !#abc (ghi) || #abc (jkl)
-fail
-#endif
-
-#unassert abc
-#if #abc || #abc (def) || #abc (ghi) || #abc (jkl)
-fail
-#endif
-
-int gobble
-
-/* make sure it can succeed too.
- also check space before open paren isn't significant */
-#if #space(s p a c e)
-;
-#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/assert_trad2.c b/gcc/testsuite/gcc.dg/cpp/assert_trad2.c
deleted file mode 100644
index 2f6963e..0000000
--- a/gcc/testsuite/gcc.dg/cpp/assert_trad2.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Malformed assertion tests. */
-/* { dg-do preprocess } */
-/* { dg-options "-traditional" } */
-
-#assert /* { dg-error "without predicate" "assert w/o predicate" } */
-#assert % /* { dg-error "an identifier" "assert punctuation" } */
-#assert 12 /* { dg-error "an identifier" "assert number" } */
-#assert abc /* { dg-error "missing" "assert w/o answer" } */
-
-#if # /* { dg-error "without predicate" "test w/o predicate" } */
-#endif
-
-#if #% /* { dg-error "an identifier" "test punctuation" } */
-#endif /* { dg-error "parse error" "" { target *-*-* } 13 } */
-
-#if #12 /* { dg-error "an identifier" "test number" } */
-#endif /* { dg-error "parse error" "" { target *-*-* } 16 } */
-
-#if #abc
-#error /* { dg-bogus "error" "test w/o answer" } */
-#endif
-
-#if #abc[def] /* { dg-error "parse error" "bad syntax" } */
-#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/assert_trad3.c b/gcc/testsuite/gcc.dg/cpp/assert_trad3.c
deleted file mode 100644
index 641ba5c..0000000
--- a/gcc/testsuite/gcc.dg/cpp/assert_trad3.c
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
-
-/* { dg-do preprocess } */
-/* { dg-options "-A abc=def -A abc\(ghi\) \"-Aabc = jkl\" -A abc=mno -A -abc=mno -traditional" } */
-
-/* Test -A command line syntax. Source Neil Booth. 31 Oct 2000. */
-
-#if !#abc (def) || !#abc (ghi) || !#abc (jkl) || #abc(mno)
-#error Command line -A assertions
-#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/defined_trad.c b/gcc/testsuite/gcc.dg/cpp/defined_trad.c
deleted file mode 100644
index 666fd71..0000000
--- a/gcc/testsuite/gcc.dg/cpp/defined_trad.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
-
-/* { dg-do preprocess } */
-/* { dg-options "-traditional" } */
-
-/* Tests tradcpp0 with defined. The defined operator in traditional C
- works just the same as the defined operator in Standard C. */
-
-/* Source: Zack Weinberg, glibc, Neil Booth 11 Dec 2000. */
-
-#if defined REGPARMS
-#error REGPARMS should not be defined
-#endif
-
-#define REGPARMS 1
-#if !defined REGPARMS
-#error REGPARMS should be defined
-#endif
-
-#define defined /* { dg-error "defined" } */
-
-/* No diagnostics, though you could argue there should be. */
-#if defined defined
-#error defined is defined!
-#endif
-
-#define is_Z_defined defined Z
-
-#if defined Z
-#error Z is not defined
-#endif
-
-/* The behaviour of "defined" when it comes from a macro expansion is
- now documented. */
-#if is_Z_defined
-#error Macro expanding into defined operator test 1
-#endif
-
-#define Z
-
-#if !defined Z
-#error Z is defined
-#endif
-
-#if !is_Z_defined
-#error Macro expanding into defined operator test 2
-#endif
-
-#undef is_Z_defined
-#undef Z
-
-/* Do all the tests over again with the () form of defined. */
-
-/* No diagnostics, though you could argue there should be. */
-#if defined(defined)
-#error defined is defined!
-#endif
-
-#define is_Z_defined defined ( Z )
-
-#if defined(Z)
-#error Z is not defined
-#endif
-
-/* The behaviour of "defined" when it comes from a macro expansion is
- now documented. */
-#if is_Z_defined
-#error Macro expanding into defined operator test 1
-#endif
-
-#define Z
-
-#if !defined(Z)
-#error Z is defined
-#endif
-
-#if !is_Z_defined
-#error Macro expanding into defined operator test 2
-#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/hash2.c b/gcc/testsuite/gcc.dg/cpp/hash2.c
deleted file mode 100644
index 4e177f4..0000000
--- a/gcc/testsuite/gcc.dg/cpp/hash2.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Test for erroneously thinking comments are token-pastes.
- From XFree86 4.0. */
-/* { dg-do preprocess } */
-/* { dg-options "-traditional" } */
-
-#ifndef foo
-#define foo /**/
-#endif
-
-#ifndef foo
-#define foo /* as nothing */
-#endif
-
-/* { dg-bogus "(start|end) of macro" "paste at end" { target *-*-* } 7 } */
-/* { dg-bogus "(start|end) of macro" "comment at end" { target *-*-* } 11 } */
diff --git a/gcc/testsuite/gcc.dg/cpp/tr-define.c b/gcc/testsuite/gcc.dg/cpp/tr-define.c
deleted file mode 100644
index 54bd7a7..0000000
--- a/gcc/testsuite/gcc.dg/cpp/tr-define.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* { dg-do preprocess } */
-/* { dg-options "-traditional -DDEFINE1DEFINE -DDEFINE2DEFIN=" } */
diff --git a/gcc/testsuite/gcc.dg/cpp/tr-direct.c b/gcc/testsuite/gcc.dg/cpp/tr-direct.c
deleted file mode 100644
index 56a52ba..0000000
--- a/gcc/testsuite/gcc.dg/cpp/tr-direct.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Test for some basic aspects of -traditional directive processing. */
-
-/* { dg-do preprocess } */
-/* { dg-options -traditional } */
-
-/* There is a #error directive. */
-
-#error bad /* { dg-error "bad" } */
-
-/* Directives with their #s indented are not recognized. */
- #if 0 /* { dg-bogus "unterminated" } */
diff --git a/gcc/testsuite/gcc.dg/cpp/tr-sign.c b/gcc/testsuite/gcc.dg/cpp/tr-sign.c
deleted file mode 100644
index e48e8cc..0000000
--- a/gcc/testsuite/gcc.dg/cpp/tr-sign.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc. */
-
-/* { dg-do preprocess { target i?86-*-* } } */
-
-/* { dg-options "-traditional" } */
-
-/* Tests that traditional numbers are signed, unless otherwise
- specified. This test assumes a 32 bit target.
-
- Neil Booth, 5 Aug 2001. Inspired by PR 3824. */
-
-#if 0xffffffff >= 0
-# error 0xffffffff /* { dg-bogus "0xffffffff" "0xffffffff positive" } */
-#endif
-
-#if 0xffffffffU <= 0
-# error 0xffffffffU /* { dg-bogus "0xffffffffU" "0xffffffffU negative" } */
-#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/tr-str.c b/gcc/testsuite/gcc.dg/cpp/tr-str.c
deleted file mode 100644
index 3423473..0000000
--- a/gcc/testsuite/gcc.dg/cpp/tr-str.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Test whether traditional stringify works. */
-/* { dg-do run } */
-/* { dg-options "-traditional-cpp" } */
-#define foo(a, b) c="a"; d="b";
-
-extern void abort ();
-
-int main ()
-{
- char *c, *d;
-
- foo (p, q);
- if (c[0] != 'p' || d[0] != 'q')
- abort ();
-
- exit (0);
-}
diff --git a/gcc/testsuite/gcc.dg/cpp/uchar-2.c b/gcc/testsuite/gcc.dg/cpp/uchar-2.c
deleted file mode 100644
index 739573c..0000000
--- a/gcc/testsuite/gcc.dg/cpp/uchar-2.c
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc. */
-
-/* { dg-do preprocess } */
-/* { dg-options "-funsigned-char -fsigned-char -traditional" } */
-
-#if defined (__CHAR_UNSIGNED__)
-# error __CHAR_UNSIGNED__ defined
-#endif