cpp: New directory.
* gcc.dg/cpp: New directory. * gcc.dg/cpp/cpp.exp: New driver. * gcc.dg/cpp/20000627-1.c: New test. * gcc.c-torture/special/special.exp: Remove entry for 921210-1.c. * gcc.c-torture/special/921210-1.c: Move to gcc.dg/cpp/19921210-1.c and rewrite as a compilation test. * gcc.dg: Move many files into the cpp subdirectory, possibly renaming or editing them as well. Old name New name 990119-1.c cpp/19990119-1.c 990228-1.c cpp/19990228-1.c 990407-1.c cpp/19990407-1.c 990409-1.c cpp/19990409-1.c 990413-1.c cpp/19990413-1.c 990703-1.c cpp/19990703-1.c 20000127-1.c cpp/20000127-1.c 20000129-1.c cpp/20000129-1.c 20000207-1.c cpp/20000207-1.c 20000207-2.c cpp/20000207-2.c 20000209-1.c cpp/20000209-1.c 20000209-2.c cpp/20000209-2.c 20000301-1.c cpp/20000301-1.c 20000419-1.c cpp/20000419-1.c 20000510-1.S cpp/20000510-1.S 20000519-1.c cpp/20000519-1.c 20000529-1.c cpp/20000529-1.c 20000625-1.c cpp/20000625-1.c 20000625-2.c cpp/20000625-2.c cpp-as1.c cpp/assert1.c cpp-as2.c cpp/assert2.c cxx-comments-1.c cpp/cxxcom1.c cxx-comments-2.c cpp/cxxcom2.c endif-label.c cpp/endif.c cpp-hash1.c cpp/hash1.c cpp-hash2.c cpp/hash2.c cpp-if1.c cpp/if-1.c cpp-if2.c cpp/if-2.c cpp-if3.c cpp/if-3.c cpp-if4.c cpp/if-4.c cpp-if5.c cpp/if-5.c cpp-cond.c cpp/if-cexp.c cpp-missingop.c cpp/if-mop.c cpp-missingparen.c cpp/if-mpar.c cpp-opprec.c cpp/if-oppr.c cpp-ifparen.c cpp/if-paren.c cpp-shortcircuit.c cpp/if-sc.c cpp-shift.c cpp/if-shift.c cpp-unary.c cpp/if-unary.c cpp-li1.c cpp/line1.c cpp-li2.c cpp/line2.c lineno.c cpp/line3.c lineno-2.c cpp/line4.c cpp-mi.c cpp/mi1.c cpp-mic.h cpp/mi1c.h cpp-micc.h cpp/mi1cc.h cpp-mind.h cpp/mi1nd.h cpp-mindp.h cpp/mi1ndp.h cpp-mix.h cpp/mi1x.h cpp-mi2.c cpp/mi2.c cpp-mi2a.h cpp/mi2a.h cpp-mi2b.h cpp/mi2b.h cpp-mi2c.h cpp/mi2c.h cpp-mi3.c cpp/mi3.c cpp-mi3.def cpp/mi3.def poison-1.c cpp/poison.c pr-impl.c cpp/prag-imp.c cpp-redef-2.c cpp/redef1.c cpp-redef.c cpp/redef2.c strpaste.c cpp/strp1.c strpaste-2.c cpp/strp2.c cpp-tradpaste.c cpp/tr-paste.c cpp-tradstringify.c cpp/tr-str.c cpp-tradwarn1.c cpp/tr-warn1.c cpp-tradwarn2.c cpp/tr-warn2.c trigraphs.c cpp/trigraphs.c cpp-unc1.c cpp/unc1.c cpp-unc2.c cpp/unc2.c cpp-unc3.c cpp/unc3.c cpp-unc.c cpp/unc4.c undef.c cpp/undef1.c undef-2.c cpp/undef2.c cpp-wi1.c cpp/widestr1.c From-SVN: r34747
This commit is contained in:
parent
b32dabe5ed
commit
d845dc520b
@ -1,3 +1,89 @@
|
||||
2000-06-27 Zack Weinberg <zack@wolery.cumb.org>
|
||||
|
||||
* gcc.dg/cpp: New directory.
|
||||
* gcc.dg/cpp/cpp.exp: New driver.
|
||||
* gcc.dg/cpp/20000627-1.c: New test.
|
||||
* gcc.c-torture/special/special.exp: Remove entry for 921210-1.c.
|
||||
* gcc.c-torture/special/921210-1.c: Move to gcc.dg/cpp/19921210-1.c
|
||||
and rewrite as a compilation test.
|
||||
|
||||
* gcc.dg: Move many files into the cpp subdirectory, possibly
|
||||
renaming or editing them as well.
|
||||
Old name New name
|
||||
990119-1.c cpp/19990119-1.c
|
||||
990228-1.c cpp/19990228-1.c
|
||||
990407-1.c cpp/19990407-1.c
|
||||
990409-1.c cpp/19990409-1.c
|
||||
990413-1.c cpp/19990413-1.c
|
||||
990703-1.c cpp/19990703-1.c
|
||||
20000127-1.c cpp/20000127-1.c
|
||||
20000129-1.c cpp/20000129-1.c
|
||||
20000207-1.c cpp/20000207-1.c
|
||||
20000207-2.c cpp/20000207-2.c
|
||||
20000209-1.c cpp/20000209-1.c
|
||||
20000209-2.c cpp/20000209-2.c
|
||||
20000301-1.c cpp/20000301-1.c
|
||||
20000419-1.c cpp/20000419-1.c
|
||||
20000510-1.S cpp/20000510-1.S
|
||||
20000519-1.c cpp/20000519-1.c
|
||||
20000529-1.c cpp/20000529-1.c
|
||||
20000625-1.c cpp/20000625-1.c
|
||||
20000625-2.c cpp/20000625-2.c
|
||||
cpp-as1.c cpp/assert1.c
|
||||
cpp-as2.c cpp/assert2.c
|
||||
cxx-comments-1.c cpp/cxxcom1.c
|
||||
cxx-comments-2.c cpp/cxxcom2.c
|
||||
endif-label.c cpp/endif.c
|
||||
cpp-hash1.c cpp/hash1.c
|
||||
cpp-hash2.c cpp/hash2.c
|
||||
cpp-if1.c cpp/if-1.c
|
||||
cpp-if2.c cpp/if-2.c
|
||||
cpp-if3.c cpp/if-3.c
|
||||
cpp-if4.c cpp/if-4.c
|
||||
cpp-if5.c cpp/if-5.c
|
||||
cpp-cond.c cpp/if-cexp.c
|
||||
cpp-missingop.c cpp/if-mop.c
|
||||
cpp-missingparen.c cpp/if-mpar.c
|
||||
cpp-opprec.c cpp/if-oppr.c
|
||||
cpp-ifparen.c cpp/if-paren.c
|
||||
cpp-shortcircuit.c cpp/if-sc.c
|
||||
cpp-shift.c cpp/if-shift.c
|
||||
cpp-unary.c cpp/if-unary.c
|
||||
cpp-li1.c cpp/line1.c
|
||||
cpp-li2.c cpp/line2.c
|
||||
lineno.c cpp/line3.c
|
||||
lineno-2.c cpp/line4.c
|
||||
cpp-mi.c cpp/mi1.c
|
||||
cpp-mic.h cpp/mi1c.h
|
||||
cpp-micc.h cpp/mi1cc.h
|
||||
cpp-mind.h cpp/mi1nd.h
|
||||
cpp-mindp.h cpp/mi1ndp.h
|
||||
cpp-mix.h cpp/mi1x.h
|
||||
cpp-mi2.c cpp/mi2.c
|
||||
cpp-mi2a.h cpp/mi2a.h
|
||||
cpp-mi2b.h cpp/mi2b.h
|
||||
cpp-mi2c.h cpp/mi2c.h
|
||||
cpp-mi3.c cpp/mi3.c
|
||||
cpp-mi3.def cpp/mi3.def
|
||||
poison-1.c cpp/poison.c
|
||||
pr-impl.c cpp/prag-imp.c
|
||||
cpp-redef-2.c cpp/redef1.c
|
||||
cpp-redef.c cpp/redef2.c
|
||||
strpaste.c cpp/strp1.c
|
||||
strpaste-2.c cpp/strp2.c
|
||||
cpp-tradpaste.c cpp/tr-paste.c
|
||||
cpp-tradstringify.c cpp/tr-str.c
|
||||
cpp-tradwarn1.c cpp/tr-warn1.c
|
||||
cpp-tradwarn2.c cpp/tr-warn2.c
|
||||
trigraphs.c cpp/trigraphs.c
|
||||
cpp-unc1.c cpp/unc1.c
|
||||
cpp-unc2.c cpp/unc2.c
|
||||
cpp-unc3.c cpp/unc3.c
|
||||
cpp-unc.c cpp/unc4.c
|
||||
undef.c cpp/undef1.c
|
||||
undef-2.c cpp/undef2.c
|
||||
cpp-wi1.c cpp/widestr1.c
|
||||
|
||||
2000-06-27 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* lib/g++.exp (g++_include_flags): Tweak.
|
||||
|
@ -1,4 +0,0 @@
|
||||
#define a1(y) (y+1)
|
||||
#define a2(y) a1(y)+1
|
||||
#define f a->f
|
||||
a2(f)
|
@ -50,17 +50,6 @@ if { [istarget rs6000-*-aix*]
|
||||
dg-runtest $srcdir/$subdir/981006-1.c "-Wuninitialized -O2 $extra_flags" ""
|
||||
dg-finish
|
||||
|
||||
# 921210-1
|
||||
set lines [gcc_target_compile $srcdir/$subdir/921210-1.c "" preprocess ""]
|
||||
set lines [prune [split [prune_warnings [prune_gcc_output $lines]] "\n"] ""]
|
||||
set line [lindex $lines [expr [llength $lines]-1]]
|
||||
regsub -all " " $line "" clean
|
||||
if [expr [string compare $clean "(a->f+1)+1"]==0] then {
|
||||
pass "921210-1.c"
|
||||
} else {
|
||||
fail "921210-1.c"
|
||||
}
|
||||
|
||||
# 920521-1
|
||||
c-torture 920521-1.c "-S"
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
/* This checks for two things:
|
||||
- an obscure corner case in the standard rules for __LINE__
|
||||
- regression of an associated bug in cpplib where the semicolon got lost */
|
||||
/* { dg-do run } */
|
||||
|
||||
int i = __LINE__\
|
||||
;
|
||||
|
||||
extern void abort (void);
|
||||
|
||||
int main (void) /* { dg-bogus "parse error" "semicolon eaten" } */
|
||||
{
|
||||
if (i != 6)
|
||||
abort ();
|
||||
else
|
||||
return 0;
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/* Test that __LINE__ works when embedded in a macro. */
|
||||
/* { dg-do run } */
|
||||
|
||||
extern void abort (void);
|
||||
|
||||
#define XLINE __LINE__
|
||||
|
||||
void
|
||||
bar(int x, int y)
|
||||
{
|
||||
if (x != y)
|
||||
abort();
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
bar(XLINE, __LINE__);
|
||||
return 0;
|
||||
}
|
13
gcc/testsuite/gcc.dg/cpp/19921210-1.c
Normal file
13
gcc/testsuite/gcc.dg/cpp/19921210-1.c
Normal file
@ -0,0 +1,13 @@
|
||||
/* Test for proper disabling of macros within their own expansions. */
|
||||
/* { dg-do compile } */
|
||||
|
||||
/* The following is a trick to evaluate a complex boolean expression
|
||||
at compile time, inspired by autoconf 2.13's sizeof-detection. */
|
||||
|
||||
enum { a = 4, f = 3 };
|
||||
|
||||
#define a1(y) (y+2)
|
||||
#define a2(y) a1(y)+1
|
||||
#define f a+f
|
||||
|
||||
char array[(a2(f)) == 10 ? 1 : -1];
|
9
gcc/testsuite/gcc.dg/cpp/19990119-1.c
Normal file
9
gcc/testsuite/gcc.dg/cpp/19990119-1.c
Normal file
@ -0,0 +1,9 @@
|
||||
/* This checks for two things:
|
||||
- an obscure corner case in the standard rules for __LINE__
|
||||
- regression of an associated bug in cpplib where the semicolon got lost */
|
||||
/* { dg-do compile } */
|
||||
|
||||
enum { i = __LINE__\
|
||||
};
|
||||
|
||||
char array[i == 6 ? 1 : -1];
|
6
gcc/testsuite/gcc.dg/cpp/19990409-1.c
Normal file
6
gcc/testsuite/gcc.dg/cpp/19990409-1.c
Normal file
@ -0,0 +1,6 @@
|
||||
/* Test that __LINE__ works when embedded in a macro. */
|
||||
/* { dg-do compile } */
|
||||
|
||||
#define XLINE __LINE__
|
||||
|
||||
char array[XLINE == __LINE__ ? 1 : -1];
|
@ -1,9 +1,7 @@
|
||||
/* Regression test for paste corner cases. Distilled from
|
||||
syscall stub logic in glibc. */
|
||||
|
||||
/* { dg-do run } */
|
||||
|
||||
#include <stdlib.h>
|
||||
/* { dg-do compile } */
|
||||
|
||||
#define ENTRY(name) name##:
|
||||
#define socket bind
|
10
gcc/testsuite/gcc.dg/cpp/20000627-1.c
Normal file
10
gcc/testsuite/gcc.dg/cpp/20000627-1.c
Normal file
@ -0,0 +1,10 @@
|
||||
/* Test for spurious warnings with backslashes in perverse locations.
|
||||
Bug exposed by Plumhall. */
|
||||
/* { dg-do compile } */
|
||||
|
||||
extern int bar;
|
||||
|
||||
#def\
|
||||
ine foo bar
|
||||
|
||||
int main(void) { return foo; }
|
70
gcc/testsuite/gcc.dg/cpp/cpp.exp
Normal file
70
gcc/testsuite/gcc.dg/cpp/cpp.exp
Normal file
@ -0,0 +1,70 @@
|
||||
# Copyright (C) 1997, 2000 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-gcc@prep.ai.mit.edu
|
||||
|
||||
# GCC testsuite that uses the `dg.exp' driver.
|
||||
|
||||
# Load support procs.
|
||||
load_lib gcc-dg.exp
|
||||
|
||||
# Utility for scanning compiler result, invoked via dg-final.
|
||||
# Call pass if pattern is present, otherwise fail.
|
||||
proc scan-assembler { testcase pattern } {
|
||||
global subdir
|
||||
|
||||
set fd [open [file rootname $testcase].s r]
|
||||
set text [read $fd]
|
||||
close $fd
|
||||
|
||||
if [regexp -- $pattern $text] {
|
||||
pass "$subdir/$testcase scan-assembler"
|
||||
} else {
|
||||
fail "$subdir/$testcase scan-assembler"
|
||||
}
|
||||
}
|
||||
|
||||
# Call pass if pattern is not present, otherwise fail.
|
||||
proc scan-assembler-not { testcase pattern } {
|
||||
global subdir
|
||||
|
||||
set fd [open [file rootname $testcase].s r]
|
||||
set text [read $fd]
|
||||
close $fd
|
||||
|
||||
if ![regexp -- $pattern $text] {
|
||||
pass "$subdir/$testcase scan-assembler-not"
|
||||
} else {
|
||||
fail "$subdir/$testcase scan-assembler-not"
|
||||
}
|
||||
}
|
||||
|
||||
# If a testcase doesn't have special options, use these.
|
||||
global DEFAULT_CFLAGS
|
||||
if ![info exists DEFAULT_CFLAGS] then {
|
||||
set DEFAULT_CFLAGS " -ansi -pedantic-errors"
|
||||
}
|
||||
|
||||
# Initialize `dg'.
|
||||
dg-init
|
||||
|
||||
# Main loop.
|
||||
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
|
||||
"" $DEFAULT_CFLAGS
|
||||
|
||||
# All done.
|
||||
dg-finish
|
@ -10,9 +10,9 @@
|
||||
wibble
|
||||
|
||||
/*
|
||||
{ dg-final { if \{ [grep cpp-li1.i baz] != "" \} \{ } }
|
||||
{ dg-final { pass "cpp-li1.i: #line directive optimization" } }
|
||||
{ dg-final { if \{ [grep line1.i baz] != "" \} \{ } }
|
||||
{ dg-final { pass "line1.i: #line directive optimization" } }
|
||||
{ dg-final { \} else \{ } }
|
||||
{ dg-final { fail "cpp-li1.i: #line directive optimization" } }
|
||||
{ dg-final { fail "line1.i: #line directive optimization" } }
|
||||
{ dg-final { \} } }
|
||||
*/
|
19
gcc/testsuite/gcc.dg/cpp/line4.c
Normal file
19
gcc/testsuite/gcc.dg/cpp/line4.c
Normal file
@ -0,0 +1,19 @@
|
||||
/* { dg-do compile } */
|
||||
|
||||
/* Test #line with and without macros for the line number. */
|
||||
|
||||
extern void abort (void);
|
||||
|
||||
#define L 90
|
||||
|
||||
#line 44
|
||||
enum { i = __LINE__ };
|
||||
|
||||
#line L
|
||||
enum { j = __LINE__ };
|
||||
|
||||
#line 16 /* N.B. the _next_ line is line 16. */
|
||||
|
||||
char array1[i == 44 ? 1 : -1];
|
||||
char array2[j == 90 ? 1 : -1];
|
||||
char array3[__LINE__ == 19 ? 1 : -1];
|
@ -1,7 +1,7 @@
|
||||
/* Test "ignore redundant include" facility.
|
||||
We must test with C and C++ comments outside the guard conditional;
|
||||
also, we test guarding with #ifndef and #if !defined.
|
||||
-H is used because cpp might confuse the issue by optimizing out
|
||||
-H is used because cpp mi1ght confuse the issue by optimizing out
|
||||
#line markers. This test only passes if each of the headers is
|
||||
read exactly once.
|
||||
|
||||
@ -12,23 +12,23 @@
|
||||
|
||||
/* { dg-do compile }
|
||||
{ dg-options "-H" }
|
||||
{ dg-error "mic\.h\n\[^\n\]*micc\.h\n\[^\n\]*mind\.h\n\[^\n\]*mindp\.h\n\[^\n\]*mix\.h" "redundant include check" { target *-*-* } 0 } */
|
||||
{ dg-error "mi1c\.h\n\[^\n\]*mi1cc\.h\n\[^\n\]*mi1nd\.h\n\[^\n\]*mi1ndp\.h\n\[^\n\]*mi1x\.h" "redundant include check" { target *-*-* } 0 } */
|
||||
|
||||
#include "cpp-mic.h"
|
||||
#include "cpp-mic.h"
|
||||
#include "mi1c.h"
|
||||
#include "mi1c.h"
|
||||
|
||||
#include "cpp-micc.h"
|
||||
#include "cpp-micc.h"
|
||||
#include "mi1cc.h"
|
||||
#include "mi1cc.h"
|
||||
|
||||
#include "cpp-mind.h"
|
||||
#include "cpp-mind.h"
|
||||
#include "mi1nd.h"
|
||||
#include "mi1nd.h"
|
||||
|
||||
#include "cpp-mindp.h"
|
||||
#include "cpp-mindp.h"
|
||||
#include "mi1ndp.h"
|
||||
#include "mi1ndp.h"
|
||||
|
||||
#define CPP_MIX_H
|
||||
#include "cpp-mix.h"
|
||||
#include "cpp-mix.h"
|
||||
#define MIX_H
|
||||
#include "mi1x.h"
|
||||
#include "mi1x.h"
|
||||
|
||||
int
|
||||
main (void)
|
@ -1,8 +1,8 @@
|
||||
/* This header is never to have its contents visible, but it should
|
||||
still receive the optimization. */
|
||||
|
||||
#ifndef CPP_MIX_H
|
||||
#define CPP_MIX_H
|
||||
#ifndef MIX_H
|
||||
#define MIX_H
|
||||
|
||||
#define main wibble
|
||||
|
@ -3,8 +3,8 @@
|
||||
Problem noted by Tom Tromey <tromey@cygnus.com>. */
|
||||
/* { dg-do compile } */
|
||||
|
||||
#include "cpp-mi2a.h"
|
||||
#include "cpp-mi2b.h"
|
||||
#include "mi2a.h"
|
||||
#include "mi2b.h"
|
||||
|
||||
int main (void)
|
||||
{
|
@ -2,4 +2,4 @@
|
||||
Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h.
|
||||
Problem noted by Tom Tromey <tromey@cygnus.com>. */
|
||||
|
||||
#include "cpp-mi2c.h"
|
||||
#include "mi2c.h"
|
@ -3,4 +3,4 @@
|
||||
Problem noted by Tom Tromey <tromey@cygnus.com>. */
|
||||
|
||||
#define need_x
|
||||
#include "cpp-mi2c.h"
|
||||
#include "mi2c.h"
|
@ -3,11 +3,11 @@
|
||||
/* { dg-do compile } */
|
||||
|
||||
#define X a
|
||||
#include "cpp-mi3.def"
|
||||
#include "mi3.def"
|
||||
#undef X
|
||||
|
||||
#define X b
|
||||
#include "cpp-mi3.def"
|
||||
#include "mi3.def"
|
||||
#undef X
|
||||
|
||||
int
|
@ -23,7 +23,7 @@ ignored
|
||||
|
||||
/* We shouldn't see unbalanced conditionals inside #if'ed out #includes. */
|
||||
#if 0
|
||||
#include "cpp-unc1.c"
|
||||
#include "unc1.c"
|
||||
#endif
|
||||
|
||||
/* The ifdef below should not get an error just because there's a bad if
|
||||
@ -32,9 +32,9 @@ ignored
|
||||
message. */
|
||||
#define FOO
|
||||
#ifdef FOO /* { dg-bogus "unterminated" "nested unterm" } */
|
||||
#include "cpp-unc1.c" /* { dg-error "" } */
|
||||
#include "unc1.c" /* { dg-error "" } */
|
||||
#endif
|
||||
|
||||
/* dg.exp doesn't read the included files for tags, so we have to
|
||||
do them explicitly here. */
|
||||
/* { dg-error "#if" "unc1.h: unterminated #if" { target *-*-* } 3 } */
|
||||
/* { dg-error "#if" "unc1.c: unterminated #if" { target *-*-* } 3 } */
|
@ -1,26 +0,0 @@
|
||||
/* { dg-do run } */
|
||||
|
||||
/* Test #line with and without macros for the line number. */
|
||||
|
||||
extern void abort (void);
|
||||
|
||||
#define L 90
|
||||
|
||||
#line 44
|
||||
int i = __LINE__;
|
||||
|
||||
#line L
|
||||
int j = __LINE__;
|
||||
|
||||
#line 14 /* N.B. the _next_ line is line 14. */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
if (i != 44)
|
||||
abort ();
|
||||
if (j != 90)
|
||||
abort ();
|
||||
if (__LINE__ != 21)
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user