+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
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");
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. */
};
#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. */
{
/* 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)
{
+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_):
{".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},
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}}\
+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.
+++ /dev/null
-/* 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
+++ /dev/null
-/* 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
+++ /dev/null
-/* 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
+++ /dev/null
-/* 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
+++ /dev/null
-/* 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 } */
+++ /dev/null
-/* { dg-do preprocess } */
-/* { dg-options "-traditional -DDEFINE1DEFINE -DDEFINE2DEFIN=" } */
+++ /dev/null
-/* 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" } */
+++ /dev/null
-/* 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
+++ /dev/null
-/* 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);
-}
+++ /dev/null
-/* 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