diff options
author | no-author <no-author@gcc.gnu.org> | 2004-08-04 21:18:29 +0000 |
---|---|---|
committer | no-author <no-author@gcc.gnu.org> | 2004-08-04 21:18:29 +0000 |
commit | 0cec0f3570ccfb06a9652854c972bb6ac44526a4 (patch) | |
tree | 7c05b77d20ddf6bd0d7a0f358286af536ca6861b | |
parent | 6f7b952085033c8d3cd11d5348d5038bbe8e022d (diff) |
This commit was manufactured by cvs2svn to create branch
'objc-improvements-branch'.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/objc-improvements-branch@85576 138bc75d-0d04-0410-961f-82ee72b054a4
41 files changed, 2123 insertions, 0 deletions
diff --git a/config/mt-gnu b/config/mt-gnu new file mode 100644 index 00000000000..15bf4171603 --- /dev/null +++ b/config/mt-gnu @@ -0,0 +1 @@ +CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE diff --git a/gcc/config/arm/arm-tune.md b/gcc/config/arm/arm-tune.md new file mode 100644 index 00000000000..8bdfd20e162 --- /dev/null +++ b/gcc/config/arm/arm-tune.md @@ -0,0 +1,5 @@ +;; -*- buffer-read-only: t -*- +;; Generated automatically by gentune.sh from arm-cores.def +(define_attr "tune" + "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,arm926ejs,arm1026ejs,arm1136js,arm1136jfs" + (const (symbol_ref "arm_tune"))) diff --git a/gcc/config/arm/gentune.sh b/gcc/config/arm/gentune.sh new file mode 100755 index 00000000000..74cc8533a11 --- /dev/null +++ b/gcc/config/arm/gentune.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Generate arm-tune.md, a file containing the tune attribute from the list of +# CPUs in arm-cores.def + +echo ";; -*- buffer-read-only: t -*-" +echo ";; Generated automatically by gentune.sh from arm-cores.def" + +allcores=`awk -F'[(,]' '/^ARM_CORE/ { cores = cores$2"," } END { print cores } ' $1` + +echo "(define_attr \"tune\"" +echo " \"$allcores\"" | sed -e 's/,"$/"/' +echo " (const (symbol_ref \"arm_tune\")))" diff --git a/gcc/config/arm/t-arm b/gcc/config/arm/t-arm new file mode 100644 index 00000000000..4f801ce939a --- /dev/null +++ b/gcc/config/arm/t-arm @@ -0,0 +1,20 @@ +# Rules common to all arm targets + +MD_INCLUDES= $(srcdir)/config/arm/arm-tune.md \ + $(srcdir)/config/arm/arm-generic.md \ + $(srcdir)/config/arm/arm1026ejs.md \ + $(srcdir)/config/arm/arm1136jfs.md \ + $(srcdir)/config/arm/arm926ejs.md \ + $(srcdir)/config/arm/cirrus.md \ + $(srcdir)/config/arm/fpa.md \ + $(srcdir)/config/arm/iwmmxt.md \ + $(srcdir)/config/arm/vfp.md + +s-config s-conditions s-flags s-codes s-constants s-emit s-recog \ + s-opinit s-extract s-peep s-attr s-attrtab s-output: $(MD_INCLUDES) + +$(srcdir)/config/arm/arm-tune.md: $(srcdir)/config/arm/gentune.sh \ + $(srcdir)/config/arm/arm-cores.def + $(SHELL) $(srcdir)/config/arm/gentune.sh \ + $(srcdir)/config/arm/arm-cores.def > \ + $(srcdir)/config/arm/arm-tune.md diff --git a/gcc/config/i386/gmm_malloc.h b/gcc/config/i386/gmm_malloc.h new file mode 100644 index 00000000000..c2454cdbfb2 --- /dev/null +++ b/gcc/config/i386/gmm_malloc.h @@ -0,0 +1,77 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC 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, or (at your option) + any later version. + + GCC 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 GCC; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you include this header file into source + files compiled by GCC, this header file does not by itself cause + the resulting executable to be covered by the GNU General Public + License. This exception does not however invalidate any other + reasons why the executable file might be covered by the GNU General + Public License. */ + +#ifndef _MM_MALLOC_H_INCLUDED +#define _MM_MALLOC_H_INCLUDED + +#include <stdlib.h> +#include <errno.h> + +static __inline__ void* +_mm_malloc (size_t size, size_t align) +{ + void * malloc_ptr; + void * aligned_ptr; + + /* Error if align is not a power of two. */ + if (align & (align - 1)) + { + errno = EINVAL; + return ((void*) 0); + } + + if (size == 0) + return ((void *) 0); + + /* Assume malloc'd pointer is aligned at least to sizeof (void*). + If necesary, add another sizeof (void*) to store the value + returned by malloc. Effectively this enforces a minimum alignment + of sizeof double. */ + if (align < 2 * sizeof (void *)) + align = 2 * sizeof (void *); + + malloc_ptr = malloc (size + align); + if (!malloc_ptr) + return ((void *) 0); + + /* Align We have at least sizeof (void *) space below malloc'd ptr. */ + aligned_ptr = (void *) (((size_t) malloc_ptr + align) + & ~((size_t) (align) - 1)); + + /* Store the original pointer just before p. */ + ((void **) aligned_ptr) [-1] = malloc_ptr; + + return aligned_ptr; +} + +static __inline__ void +_mm_free (void * aligned_ptr) +{ + if (aligned_ptr) + free (((void **) aligned_ptr) [-1]); +} + +#endif /* _MM_MALLOC_H_INCLUDED */ diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h new file mode 100644 index 00000000000..16a808c7d81 --- /dev/null +++ b/gcc/config/i386/pmm_malloc.h @@ -0,0 +1,56 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC 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, or (at your option) + any later version. + + GCC 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 GCC; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you include this header file into source + files compiled by GCC, this header file does not by itself cause + the resulting executable to be covered by the GNU General Public + License. This exception does not however invalidate any other + reasons why the executable file might be covered by the GNU General + Public License. */ + +#ifndef _MM_MALLOC_H_INCLUDED +#define _MM_MALLOC_H_INCLUDED + +#include <stdlib.h> + +/* We can't depend on <stdlib.h> since the prototype of posix_memalign + may not be visible. */ +extern int posix_memalign (void **, size_t, size_t); + +static __inline void * +_mm_malloc (size_t size, size_t alignment) +{ + void *ptr; + if (alignment == 1) + return malloc (size); + if (alignment == 2 || (sizeof (void *) == 8 && alignment == 4)) + alignment = sizeof (void *); + if (posix_memalign (&ptr, alignment, size) == 0) + return ptr; + else + return NULL; +} + +static __inline void +_mm_free (void * ptr) +{ + free (ptr); +} + +#endif /* _MM_MALLOC_H_INCLUDED */ diff --git a/gcc/config/i386/t-gmm_malloc b/gcc/config/i386/t-gmm_malloc new file mode 100644 index 00000000000..c37f8a75985 --- /dev/null +++ b/gcc/config/i386/t-gmm_malloc @@ -0,0 +1,6 @@ +# Install gmm_malloc.h as mm_malloc.h. + +EXTRA_HEADERS += mm_malloc.h +mm_malloc.h: $(srcdir)/config/i386/gmm_malloc.h + rm -f $@ + cat $^ > $@ diff --git a/gcc/config/i386/t-pmm_malloc b/gcc/config/i386/t-pmm_malloc new file mode 100644 index 00000000000..109009fbfc5 --- /dev/null +++ b/gcc/config/i386/t-pmm_malloc @@ -0,0 +1,6 @@ +# Install pmm_malloc.h as mm_malloc.h. + +EXTRA_HEADERS += mm_malloc.h +mm_malloc.h: $(srcdir)/config/i386/pmm_malloc.h + rm -f $@ + cat $^ > $@ diff --git a/gcc/config/sh/symbian-pre.h b/gcc/config/sh/symbian-pre.h new file mode 100644 index 00000000000..44fb4a939e2 --- /dev/null +++ b/gcc/config/sh/symbian-pre.h @@ -0,0 +1,41 @@ +/* Definitions for the Symbian OS running on an SH part. + This file is included before any other target specific headers. + + Copyright (C) 2004 Free Software Foundation, Inc. + Contributed by Red Hat. + + This file is part of GCC. + + GCC 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, or (at your + option) any later version. + + GCC 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 GCC; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Enable Symbian specific code. */ +#define SYMBIAN 1 + +/* Default to using the Renesas ABI. */ +#define TARGET_ABI_DEFAULT RENESAS_BIT + +#define SUBTARGET_CPP_SPEC "" + +/* Get tree.c to declare merge_dllimport_decl_attributes(). */ +#define TARGET_DLLIMPORT_DECL_ATTRIBUTES + +/* The Symbian OS currently does not support exception handling. */ +#define SUBTARGET_CC1PLUS_SPEC "-fno-exceptions" + +/* Create constructor/destructor sections without the writable flag. + Symbian puts them into the text segment and munges them later on. */ +#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"ax\",@progbits" +#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"ax\",@progbits" diff --git a/gcc/testsuite/g++.dg/inherit/ptrmem2.C b/gcc/testsuite/g++.dg/inherit/ptrmem2.C new file mode 100644 index 00000000000..a13705576a4 --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/ptrmem2.C @@ -0,0 +1,25 @@ +// PR c++/16810 + +struct C { + virtual void f() {} +}; + +struct B {virtual ~B() {} }; + +class D : public B, public C +{ +public: + virtual void f() {} +}; + +typedef void ( C::*FP)(); +typedef void ( D::*D_f)(); + +int main() { + D *d = new D(); + C *c = d; + + const FP fptr = (FP) &D::f;; + (d->* (D_f)fptr)(); +} + diff --git a/gcc/testsuite/g++.dg/init/null1.C b/gcc/testsuite/g++.dg/init/null1.C new file mode 100644 index 00000000000..eff3f610968 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/null1.C @@ -0,0 +1,6 @@ +// PR c++/16489 + +const int NULL = 0; +int main() { + double* p = NULL; +} diff --git a/gcc/testsuite/g++.dg/lookup/using12.C b/gcc/testsuite/g++.dg/lookup/using12.C new file mode 100644 index 00000000000..030385581a5 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/using12.C @@ -0,0 +1,4 @@ +// PR c++/16707 + +int i; +using N::i; // { dg-error "declared|expected" } diff --git a/gcc/testsuite/g++.dg/parse/namespace10.C b/gcc/testsuite/g++.dg/parse/namespace10.C new file mode 100644 index 00000000000..9f93d1b6897 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/namespace10.C @@ -0,0 +1,9 @@ +// PR c++/16529 + +namespace m {} // { dg-error "" } + +namespace n { + namespace m {} +} + +namespace m = n::m; // { dg-error "" } diff --git a/gcc/testsuite/g++.dg/template/spec17.C b/gcc/testsuite/g++.dg/template/spec17.C new file mode 100644 index 00000000000..23755768423 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/spec17.C @@ -0,0 +1,11 @@ +// PR c++/16224 + +namespace io { + template <typename> int foo(); // { dg-error "" } +} + +using namespace io; + +template<> int foo<int>(); // { dg-error "" } + +int a = foo<int>(); diff --git a/gcc/testsuite/gcc.c-torture/execute/pr16790-1.c b/gcc/testsuite/gcc.c-torture/execute/pr16790-1.c new file mode 100644 index 00000000000..dc6a77404b5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr16790-1.c @@ -0,0 +1,41 @@ +/* PR middle-end/16790. */ + +extern void abort (); + +static void test1(unsigned int u1) +{ + unsigned int y_final_1; + signed short y_middle; + unsigned int y_final_2; + + y_final_1 = (unsigned int)( (signed short)(u1 * 2) * 3 ); + y_middle = (signed short)(u1 * 2); + y_final_2 = (unsigned int)( y_middle * 3 ); + + if (y_final_1 != y_final_2) + abort (); +} + + +static void test2(unsigned int u1) +{ + unsigned int y_final_1; + signed short y_middle; + unsigned int y_final_2; + + y_final_1 = (unsigned int)( (signed short)(u1 << 1) * 3 ); + y_middle = (signed short)(u1 << 1); + y_final_2 = (unsigned int)( y_middle * 3 ); + + if (y_final_1 != y_final_2) + abort (); +} + + +int main() +{ + test1(0x4000U); + test2(0x4000U); + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/array-7.c b/gcc/testsuite/gcc.dg/array-7.c new file mode 100644 index 00000000000..b32d4ea03d6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/array-7.c @@ -0,0 +1,14 @@ +/* Test for array of incomplete structure type - Zack Weinberg in + <http://gcc.gnu.org/ml/gcc-patches/2004-08/msg00108.html>. */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +struct foo; + +void +f (void) +{ + struct foo { int a; int b; }; +} + +struct foo array[5]; /* { dg-error "storage size" } */ diff --git a/gcc/testsuite/gcc.dg/c99-tag-2.c b/gcc/testsuite/gcc.dg/c99-tag-2.c new file mode 100644 index 00000000000..22cf90e27d3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-tag-2.c @@ -0,0 +1,16 @@ +/* Test for handling of tags. A struct defined in an inner scope does + not match one declared in an outer scope. */ +/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +struct s; +struct t { struct s *p; } x; + +void +f (void) +{ + /* This is a different struct s from the outer one. */ + struct s { int a; } y; + x.p = &y; /* { dg-error "incompatible" } */ +} diff --git a/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp b/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp new file mode 100644 index 00000000000..0e56b8a00bd --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp @@ -0,0 +1,139 @@ +# Copyright (C) 2002, 2003, 2004 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. +# +# This file was written by Jakub Jelinek, <jakub@redhat.com> +# Based on compat.exp writte by Janis Johnson, <janis187@us.ibm.com> + + +# Test interoperability of two compilers that follow the same ABI. +# +# Break simple tests into two pieces and see that they work when linked +# together. If an alternate compiler is specified then the two main +# pieces of each test are compiled with different compilers. The +# alternate compiler must be installed, and is specified by defining +# ALT_CC_UNDER_TEST in the environment. +# +# struct-layout-1 are generated structure layout interoperability tests, +# so a generator first needs to be compiled on host, run there and the +# generated tests then compiled on build and executed on target. + +if $tracelevel then { + strace $tracelevel +} + +global GCC_UNDER_TEST + +# Load procedures from common libraries. +load_lib standard.exp +load_lib gcc.exp + +# +# compat-use-alt-compiler -- make the alternate compiler the default +# +proc compat-use-alt-compiler { } { + global GCC_UNDER_TEST ALT_CC_UNDER_TEST + global same_alt + + # We don't need to do this if the alternate compiler is actually + # the same as the compiler under test. + if { $same_alt == 0 } then { + set GCC_UNDER_TEST $ALT_CC_UNDER_TEST + } +} + +# +# compat-use-tst-compiler -- make compiler under test the default +# +proc compat-use-tst-compiler { } { + global GCC_UNDER_TEST save_gcc_under_test + global same_alt + + # We don't need to do this if the alternate compiler is actually + # the same as the compiler under test. + + if { $same_alt == 0 } then { + set GCC_UNDER_TEST $save_gcc_under_test + } +} + +# Load the language-independent compabibility support procedures. +# This must be done after the compat-use-*-compiler definitions. +load_lib compat.exp + +gcc_init + +# Save variables for the C compiler under test, which each test will +# change a couple of times. This must be done after calling gcc-init. +set save_gcc_under_test $GCC_UNDER_TEST + +# Define an identifier for use with this suite to avoid name conflicts +# with other compat tests running at the same time. +set sid "c_compat" + +# Find out whether there is an alternate compiler to test. If the +# variable is defined but is set to "same", that means we use the same +# compiler twice, which is meaningful if the two parts of COMPAT_OPTIONS +# are different. +set use_alt 0 +set same_alt 0 +if [info exists ALT_CC_UNDER_TEST] then { + set use_alt 1 + if [string match "same" $ALT_CC_UNDER_TEST] then { + set same_alt 1 + } +} + +set tstobjdir "$tmpdir/gcc.dg-struct-layout-1" +set generator "$tmpdir/gcc.dg-struct-layout-1_generate" + +set generator_src "$srcdir/$subdir/struct-layout-1_generate.c" +set generator_src "$generator_src $srcdir/$subdir/generate-random.c" +set generator_src "$generator_src $srcdir/$subdir/generate-random_r.c" +set generator_inc "-I$srcdir/$subdir -I$srcdir/../../include" +set generator_inc "$generator_inc -I$rootme/../libiberty" +set generator_lib "-L$rootme/../libiberty -liberty" +set generator_cmd "-o $generator $generator_src $generator_inc $generator_lib" + +set status [remote_exec host "$HOSTCC $HOSTCFLAGS $generator_cmd"] +set status [lindex $status 0] +if { $status == 0 } then { + file delete -force $tstobjdir + file mkdir $tstobjdir + set generator_args "-s $srcdir/$subdir -d $tstobjdir" + if [info exists env(RUN_ALL_COMPAT_TESTS) ] then { + set generator_args "$generator_args -n 15000" + } + set status [remote_exec host "$generator $generator_args"] + set status [lindex $status 0] + if { $status == 0 } then { + foreach src [lsort [find $tstobjdir *_main.c]] { + # If we're only testing specific files and this isn't one + # of them, skip it. + if ![runtest_file_p $runtests $src] then { + continue + } + + compat-execute $src $sid $use_alt + } + } else { + warning "Could not execute gcc.dg/compat/struct-layout-1 generator" + } +} else { + warning "Could not compile gcc.dg/compat/struct-layout-1 generator" +} + +# Restore the original compiler under test. +compat-use-tst-compiler diff --git a/gcc/testsuite/gcc.dg/i386-sse-9.c b/gcc/testsuite/gcc.dg/i386-sse-9.c new file mode 100644 index 00000000000..1fe7adac542 --- /dev/null +++ b/gcc/testsuite/gcc.dg/i386-sse-9.c @@ -0,0 +1,36 @@ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -msse" } */ +#include <xmmintrin.h> +#include <stdlib.h> +#include <stddef.h> +#include <string.h> + +int +main() +{ + int alignment, n; + void *ptr; + int errors = 0; + const char test [] = "This is a test."; + + for (alignment = 1; alignment <= (1 << 20); alignment += alignment) + { + ptr = _mm_malloc (alignment, alignment); + if (((ptrdiff_t) ptr) & (alignment - 1)) + abort (); + if (ptr) + { + n = alignment > sizeof test ? sizeof test : alignment; + memcpy (ptr, test, n); + if (memcmp (ptr, test, n) != 0) + errors++; + _mm_free (ptr); + } + else + errors++; + } + + if (errors != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/ia64-got-1.c b/gcc/testsuite/gcc.dg/ia64-got-1.c new file mode 100644 index 00000000000..d53560f8156 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ia64-got-1.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target ia64*-*-* } } */ +/* { dg-options "-O2 -fPIC" } */ + +/* { dg-final { scan-assembler "@ltoffx\\(object#\\)" } } */ +/* { dg-final { scan-assembler "@ltoffx\\(object#\[-+\]16384\\)" } } */ +/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]1\\)" } } */ +/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]8191\\)" } } */ +/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]8192\\)" } } */ +/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]8193\\)" } } */ +/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]16383\\)" } } */ +/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]16385\\)" } } */ + +/* must not be in sdata */ +extern char object[]; + +#define r(n) char *r_##n (void) { return &object[n]; } +#define R(n) char *R_##n (void) { return &object[-n]; } + +#define t(n) r(n) R(n) + +t(0) t(1) +t(8191) t(8192) t(8193) +t(16383) t(16384) t(16385) diff --git a/gcc/testsuite/gcc.dg/pr16155.c b/gcc/testsuite/gcc.dg/pr16155.c new file mode 100644 index 00000000000..64df264d0b6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr16155.c @@ -0,0 +1,17 @@ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-maltivec -ansi" } */ + +/* PR 16155 + * Compilation of a simple altivec test program fails if the -ansi flag is + * given to gcc, when compiling with -maltivec. + */ + +#include <altivec.h> + +void foo(void) +{ + vector unsigned short a, b; + a = vec_splat(b, 0); +} + +/* { dg-bogus "parse error before \"typeof\"" "-maltivec -mansi" { target powerpc*-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/profile-generate-1.c b/gcc/testsuite/gcc.dg/profile-generate-1.c new file mode 100644 index 00000000000..9c73e6c63e7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/profile-generate-1.c @@ -0,0 +1,35 @@ +/* Bug 16325. */ +/* { dg-options "-O -fprofile-generate" } */ + +extern void abort (void); + +int *p1; +int *p2; +int *p3; + +int ga = 100; + +int +sub (int i, int j) +{ + int k; + int l; + int m; + int n; + p1 = &k; + p2 = &l; + p3 = &m; + k = 20; + l = 30; + m = 40; + n = i / j; + return n + ga; +} + +int +main(void) +{ + if (sub (99, 33) != 103) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/redecl-2.c b/gcc/testsuite/gcc.dg/redecl-2.c new file mode 100644 index 00000000000..b1b7dc929de --- /dev/null +++ b/gcc/testsuite/gcc.dg/redecl-2.c @@ -0,0 +1,68 @@ +/* Test for multiple declarations of an identifier at same block + scope: only valid case is all extern. */ +/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void +fa0 (void) +{ + int a0; /* { dg-error "previous declaration" } */ + int a0; /* { dg-error "redeclaration" } */ +} + +void +fa1 (void) +{ + int a1; /* { dg-error "previous declaration" } */ + static int a1; /* { dg-error "redeclaration" } */ +} + +void +fa2 (void) +{ + int a2; /* { dg-error "previous declaration" } */ + extern int a2; /* { dg-error "follows declaration with no linkage" } */ +} + +void +fa3 (void) +{ + static int a3; /* { dg-error "previous declaration" } */ + int a3; /* { dg-error "redeclaration" } */ +} + +void +fa4 (void) +{ + static int a4; /* { dg-error "previous declaration" } */ + static int a4; /* { dg-error "redeclaration" } */ +} + +void +fa5 (void) +{ + static int a5; /* { dg-error "previous declaration" } */ + extern int a5; /* { dg-error "follows declaration with no linkage" } */ +} + +void +fa6 (void) +{ + extern int a6; /* { dg-error "previous declaration" } */ + int a6; /* { dg-error "follows extern declaration" } */ +} + +void +fa7 (void) +{ + extern int a7; /* { dg-error "previous declaration" } */ + static int a7; /* { dg-error "follows extern declaration" } */ +} + +void +fa8 (void) +{ + extern int a8; + extern int a8; +} diff --git a/gcc/testsuite/gcc.dg/redecl-5.c b/gcc/testsuite/gcc.dg/redecl-5.c new file mode 100644 index 00000000000..a689295bb85 --- /dev/null +++ b/gcc/testsuite/gcc.dg/redecl-5.c @@ -0,0 +1,19 @@ +/* Test for multiple declarations and composite types. Diagnosis of + incompatible implicit declaration. */ +/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=c89" } */ + +void +f (void) +{ + long z(); /* { dg-error "previous implicit declaration" } */ +} + +void +g (void) +{ + z(); /* { dg-error "incompatible" } */ + labs(1); /* { dg-warning "incompatible" } */ + printf("x"); /* { dg-warning "incompatible" } */ +} diff --git a/gcc/testsuite/gcc.dg/switch-warn-1.c b/gcc/testsuite/gcc.dg/switch-warn-1.c new file mode 100644 index 00000000000..04ca4e36765 --- /dev/null +++ b/gcc/testsuite/gcc.dg/switch-warn-1.c @@ -0,0 +1,47 @@ +/* { dg-do run } */ +/* { dg-options "-O0" } */ + +extern void abort (void); +extern void exit (int); + +/* Check that out-of-bounds case warnings work in the case that the + testing expression is promoted. */ +int +foo1 (unsigned char i) +{ + switch (i) + { + case -1: /* { dg-warning "case label value is less than minimum value for type" } */ + return 1; + case 256: /* { dg-warning "case label value exceeds maximum value for type" } */ + return 2; + default: + return 3; + } +} + +/* Like above, but for case ranges that need to be satured. */ +int +foo2 (unsigned char i) +{ + switch (i) + { + case -1 ... 1: /* { dg-warning "lower value in case label range less than minimum value for type" } */ + return 1; + case 254 ... 256: /* { dg-warning "upper value in case label range exceeds maximum value for type" } */ + return 2; + default: + return 3; + } +} + +int +main (void) +{ + if (foo1 (10) != 3) + abort (); + if (foo2 (10) != 3) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.dg/switch-warn-2.c b/gcc/testsuite/gcc.dg/switch-warn-2.c new file mode 100644 index 00000000000..7778b66e087 --- /dev/null +++ b/gcc/testsuite/gcc.dg/switch-warn-2.c @@ -0,0 +1,26 @@ +/* This should not warn about the case label being out of range. */ +/* { dg-do run } */ +/* { dg-options "-O0" } */ + +extern void abort (void); +extern void exit (int); + +int +foo (unsigned int i) +{ + switch (i) + { + case 123456123456ULL: /* { dg-warning "large integer implicitly truncated to unsigned type" } */ + return 0; + default: + return 3; + } +} + +int +main (void) +{ + if (foo (10) != 3) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/symbian1.c b/gcc/testsuite/gcc.dg/symbian1.c new file mode 100644 index 00000000000..25e81281683 --- /dev/null +++ b/gcc/testsuite/gcc.dg/symbian1.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target arm*-*-symbianelf* } } */ +/* Symbian OS requires that all defined symbols with external linkage + have the ELF STV_HIDDEN attribute set by default. */ +/* { dg-final { scan-assembler ".hidden.*i" } } */ +/* { dg-final { scan-assembler ".hidden.*j" } } */ +/* { dg-final { scan-assembler ".hidden.*f" } } */ + +int i; +int j = 3; +void f() {} + diff --git a/gcc/testsuite/gcc.dg/symbian2.c b/gcc/testsuite/gcc.dg/symbian2.c new file mode 100644 index 00000000000..98701636875 --- /dev/null +++ b/gcc/testsuite/gcc.dg/symbian2.c @@ -0,0 +1,10 @@ +/* { dg-do compile { target arm*-*-symbianelf* } } */ +/* { dg-options "-O2" } */ + +/* Symbian OS requires that builtins not be expanded by default. Make + sure that a reference to "strlen" is emitted. */ +/* { dg-final { scan-assembler "strlen" } } */ + +int f() { + return strlen("abc"); +} diff --git a/gcc/testsuite/gfortran.dg/g77/cabs.f b/gcc/testsuite/gfortran.dg/g77/cabs.f new file mode 100644 index 00000000000..20a97db9dbd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/g77/cabs.f @@ -0,0 +1,15 @@ +c { dg-do run { xfail mips-sgi-irix6* } } PR 16292 + program cabs_1 + complex z0 + real r0 + complex*16 z1 + real*8 r1 + + z0 = cmplx(3.,4.) + r0 = cabs(z0) + if (r0 .ne. 5.) call abort + + z1 = dcmplx(3.d0,4.d0) + r1 = zabs(z1) + if (r1 .ne. 5.d0) call abort + end diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c new file mode 100644 index 00000000000..f10ec75e1cc --- /dev/null +++ b/gcc/tree-ssa-loop-ch.c @@ -0,0 +1,288 @@ +/* Loop header copying on trees. + Copyright (C) 2004 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC 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, or (at your option) any +later version. + +GCC 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 GCC; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tree.h" +#include "rtl.h" +#include "tm_p.h" +#include "hard-reg-set.h" +#include "basic-block.h" +#include "output.h" +#include "diagnostic.h" +#include "tree-flow.h" +#include "tree-dump.h" +#include "tree-pass.h" +#include "timevar.h" +#include "cfgloop.h" +#include "tree-inline.h" +#include "flags.h" +#include "tree-inline.h" + +/* Duplicates headers of loops if they are small enough, so that the statements + in the loop body are always executed when the loop is entered. This + increases effectivity of code motion optimizations, and reduces the need + for loop preconditioning. */ + +/* Check whether we should duplicate HEADER of LOOP. At most *LIMIT + instructions should be duplicated, limit is decreased by the actual + amount. */ + +static bool +should_duplicate_loop_header_p (basic_block header, struct loop *loop, + int *limit) +{ + block_stmt_iterator bsi; + tree last; + + /* Do not copy one block more than once (we do not really want to do + loop peeling here). */ + if (header->aux) + return false; + + if (!header->succ) + abort (); + if (!header->succ->succ_next) + return false; + if (header->succ->succ_next->succ_next) + return false; + if (flow_bb_inside_loop_p (loop, header->succ->dest) + && flow_bb_inside_loop_p (loop, header->succ->succ_next->dest)) + return false; + + /* If this is not the original loop header, we want it to have just + one predecessor in order to match the && pattern. */ + if (header != loop->header + && header->pred->pred_next) + return false; + + last = last_stmt (header); + if (TREE_CODE (last) != COND_EXPR) + return false; + + /* Approximately copy the conditions that used to be used in jump.c -- + at most 20 insns and no calls. */ + for (bsi = bsi_start (header); !bsi_end_p (bsi); bsi_next (&bsi)) + { + last = bsi_stmt (bsi); + + if (TREE_CODE (last) == LABEL_EXPR) + continue; + + if (get_call_expr_in (last)) + return false; + + *limit -= estimate_num_insns (last); + if (*limit < 0) + return false; + } + + return true; +} + +/* Duplicates destinations of edges in BBS_TO_DUPLICATE. */ + +static void +duplicate_blocks (varray_type bbs_to_duplicate) +{ + unsigned i; + edge preheader_edge, e, e1; + basic_block header, new_header; + tree phi, new_phi, var; + + /* TODO: It should be quite easy to keep the dominance information + up-to-date. */ + free_dominance_info (CDI_DOMINATORS); + + for (i = 0; i < VARRAY_ACTIVE_SIZE (bbs_to_duplicate); i++) + { + preheader_edge = VARRAY_GENERIC_PTR_NOGC (bbs_to_duplicate, i); + header = preheader_edge->dest; + + if (!header->aux) + abort (); + header->aux = NULL; + + new_header = duplicate_block (header, preheader_edge); + + /* Create the phi nodes on on entry to new_header. */ + for (phi = phi_nodes (header), var = PENDING_STMT (preheader_edge); + phi; + phi = TREE_CHAIN (phi), var = TREE_CHAIN (var)) + { + new_phi = create_phi_node (PHI_RESULT (phi), new_header); + add_phi_arg (&new_phi, TREE_VALUE (var), preheader_edge); + } + PENDING_STMT (preheader_edge) = NULL; + + /* Add the phi arguments to the outgoing edges. */ + for (e = header->succ; e; e = e->succ_next) + { + for (e1 = new_header->succ; e1->dest != e->dest; e1 = e1->succ_next) + continue; + + for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi)) + { + tree def = PHI_ARG_DEF_FROM_EDGE (phi, e); + add_phi_arg (&phi, def, e1); + } + } + } + + calculate_dominance_info (CDI_DOMINATORS); + + rewrite_ssa_into_ssa (); +} + +/* Checks whether LOOP is a do-while style loop. */ + +static bool +do_while_loop_p (struct loop *loop) +{ + tree stmt = last_stmt (loop->latch); + + /* If the latch of the loop is not empty, it is not a do-while loop. */ + if (stmt + && TREE_CODE (stmt) != LABEL_EXPR) + return false; + + /* If the header contains just a condition, it is not a do-while loop. */ + stmt = last_and_only_stmt (loop->header); + if (stmt + && TREE_CODE (stmt) == COND_EXPR) + return false; + + return true; +} + +/* For all loops, copy the condition at the end of the loop body in front + of the loop. This is beneficial since it increases efficiency of + code motion optimizations. It also saves one jump on entry to the loop. */ + +static void +copy_loop_headers (void) +{ + struct loops *loops; + unsigned i; + struct loop *loop; + basic_block header; + edge preheader_edge; + varray_type bbs_to_duplicate = NULL; + + loops = loop_optimizer_init (dump_file); + if (!loops) + return; + + /* We do not try to keep the information about irreducible regions + up-to-date. */ + loops->state &= ~LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS; + +#ifdef ENABLE_CHECKING + verify_loop_structure (loops); +#endif + + for (i = 1; i < loops->num; i++) + { + /* Copy at most 20 insns. */ + int limit = 20; + + loop = loops->parray[i]; + preheader_edge = loop_preheader_edge (loop); + header = preheader_edge->dest; + + /* If the loop is already a do-while style one (either because it was + written as such, or because jump threading transformed it into one), + we might be in fact peeling the first iteration of the loop. This + in general is not a good idea. */ + if (do_while_loop_p (loop)) + continue; + + /* Iterate the header copying up to limit; this takes care of the cases + like while (a && b) {...}, where we want to have both of the conditions + copied. TODO -- handle while (a || b) - like cases, by not requiring + the header to have just a single successor and copying up to + postdominator. + + We do not really copy the blocks immediately, so that we do not have + to worry about updating loop structures, and also so that we do not + have to rewrite variables out of and into ssa form for each block. + Instead we just record the block into worklist and duplicate all of + them at once. */ + while (should_duplicate_loop_header_p (header, loop, &limit)) + { + if (!bbs_to_duplicate) + VARRAY_GENERIC_PTR_NOGC_INIT (bbs_to_duplicate, 10, + "bbs_to_duplicate"); + VARRAY_PUSH_GENERIC_PTR_NOGC (bbs_to_duplicate, preheader_edge); + header->aux = &header->aux; + + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, + "Scheduled basic block %d for duplication.\n", + header->index); + + /* Find a successor of header that is inside a loop; i.e. the new + header after the condition is copied. */ + if (flow_bb_inside_loop_p (loop, header->succ->dest)) + preheader_edge = header->succ; + else + preheader_edge = header->succ->succ_next; + header = preheader_edge->dest; + } + } + + loop_optimizer_finalize (loops, NULL); + + if (bbs_to_duplicate) + { + duplicate_blocks (bbs_to_duplicate); + VARRAY_FREE (bbs_to_duplicate); + } + + /* Run cleanup_tree_cfg here regardless of whether we have done anything, so + that we cleanup the blocks created in order to get the loops into a + canonical shape. */ + cleanup_tree_cfg (); +} + +static bool +gate_ch (void) +{ + return flag_tree_ch != 0; +} + +struct tree_opt_pass pass_ch = +{ + "ch", /* name */ + gate_ch, /* gate */ + copy_loop_headers, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_TREE_CH, /* tv_id */ + PROP_cfg | PROP_ssa | PROP_alias, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + (TODO_dump_func + | TODO_verify_ssa) /* todo_flags_finish */ +}; diff --git a/gcc/vec.h b/gcc/vec.h new file mode 100644 index 00000000000..33d9bf6a6dd --- /dev/null +++ b/gcc/vec.h @@ -0,0 +1,723 @@ +/* Vector API for GNU compiler. + Copyright (C) 2004 Free Software Foundation, Inc. + Contributed by Nathan Sidwell <nathan@codesourcery.com> + +This file is part of GCC. + +GCC 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, or (at your option) any later +version. + +GCC 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 GCC; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ + +#ifndef GCC_VEC_H +#define GCC_VEC_H + +/* The macros here implement a set of templated vector types and + associated interfaces. These templates are implemented with + macros, as we're not in C++ land. The interface functions are + typesafe and use static inline functions, sometimes backed by + out-of-line generic functions. The vectors are designed to + interoperate with the GTY machinery. + + Because of the different behaviour of objects and of pointers to + objects, there are two flavours. One to deal with a vector of + pointers to objects, and one to deal with a vector of objects + themselves. Both of these pass pointers to objects around -- in + the former case the pointers are stored into the vector and in the + latter case the pointers are dereferenced and the objects copied + into the vector. Therefore, when using a vector of pointers, the + objects pointed to must be long lived, but when dealing with a + vector of objects, the source objects need not be. + + There are both 'index' and 'iterate' accessors. The iterator + returns a boolean iteration condition and updates the iteration + variable passed by reference. Because the iterator will be + inlined, the address-of can be optimized away. + + The vectors are implemented using the trailing array idiom, thus + they are not resizeable without changing the address of the vector + object itself. This means you cannot have variables or fields of + vector type -- always use a pointer to a vector. The one exception + is the final field of a structure, which could be a vector type. + You will have to use the embedded_size & embedded_init calls to + create such objects, and they will probably not be resizeable (so + don't use the 'safe' allocation variants). The trailing array + idiom is used (rather than a pointer to an array of data), because, + if we allow NULL to also represent an empty vector, empty vectors + occupy minimal space in the structure containing them. + + Each operation that increases the number of active elements is + available in 'quick' and 'safe' variants. The former presumes that + there is sufficient allocated space for the operation to succeed + (it aborts if there is not). The latter will reallocate the + vector, if needed. Reallocation causes an exponential increase in + vector size. If you know you will be adding N elements, it would + be more efficient to use the reserve operation before adding the + elements with the 'quick' operation. You may also use the reserve + operation with a -1 operand, to gain control over exactly when + reallocation occurs. + + You should prefer the push and pop operations, as they append and + remove from the end of the vector. If you need to remove several + items in one go, use the truncate operation. The insert and remove + operations allow you to change elements in the middle of the + vector. There are two remove operations, one which preserves the + element ordering 'ordered_remove', and one which does not + 'unordered_remove'. The latter function copies the end element + into the removed slot, rather than invoke a memmove operation. + + If you need to directly manipulate a vector, then the 'address' + accessor will return the address of the start of the vector. Also + the 'space' predicate will tell you whether there is spare capacity + in the vector. You will not normally need to use these two functions. + + Vector types are defined using a DEF_VEC_x(TYPEDEF) macro, and + variables of vector type are declared using a VEC(TYPEDEF) + macro. The 'x' letter indicates whether TYPEDEF is a pointer (P) or + object (O) type. + + An example of their use would be, + + DEF_VEC_P(tree); // define a vector of tree pointers. This must + // appear at file scope. + + struct my_struct { + VEC(tree) *v; // A (pointer to) a vector of tree pointers. + }; + + struct my_struct *s; + + if (VEC_length(tree,s->v)) { we have some contents } + VEC_safe_push(tree,s->v,decl); // append some decl onto the end + for (ix = 0; VEC_iterate(tree,s->v,ix,t); ix++) + { do something with t } + +*/ + +/* Macros to invoke API calls. A single macro works for both pointer + and object vectors, but the argument and return types might well be + different. In each macro, TDEF is the typedef of the vector + elements. Some of these macros pass the vector, V, by reference + (by taking its address), this is noted in the descriptions. */ + +/* Length of vector + unsigned VEC_T_length(const VEC(T) *v); + + Return the number of active elements in V. V can be NULL, in which + case zero is returned. */ + +#define VEC_length(TDEF,V) (VEC_OP(TDEF,length)(V)) + +/* Get the final element of the vector. + T VEC_T_last(VEC(T) *v); // Pointer + T *VEC_T_last(VEC(T) *v); // Object + + Return the final element. If V is empty, abort. */ + +#define VEC_last(TDEF,V) (VEC_OP(TDEF,last)(V VEC_CHECK_INFO)) + +/* Index into vector + T VEC_T_index(VEC(T) *v, unsigned ix); // Pointer + T *VEC_T_index(VEC(T) *v, unsigned ix); // Object + + Return the IX'th element. If IX is outside the domain of V, + abort. */ + +#define VEC_index(TDEF,V,I) (VEC_OP(TDEF,index)(V,I VEC_CHECK_INFO)) + +/* Iterate over vector + int VEC_T_iterate(VEC(T) *v, unsigned ix, T &ptr); // Pointer + int VEC_T_iterate(VEC(T) *v, unsigned ix, T *&ptr); // Object + + Return iteration condition and update PTR to point to the IX'th + element. At the end of iteration, sets PTR to NULL. Use this to + iterate over the elements of a vector as follows, + + for (ix = 0; VEC_iterate(T,v,ix,ptr); ix++) + continue; */ + +#define VEC_iterate(TDEF,V,I,P) (VEC_OP(TDEF,iterate)(V,I,&(P))) + +/* Allocate new vector. + VEC(T) *VEC_T_alloc(int reserve); + + Allocate a new vector with space for RESERVE objects. If RESERVE + is <= 0, a default number of slots are created. */ + +#define VEC_alloc(TDEF,A) (VEC_OP(TDEF,alloc)(A MEM_STAT_INFO)) + +/* Use these to determine the required size and initialization of a + vector embedded within another structure (as the final member). + + size_t VEC_T_embedded_size(int reserve); + void VEC_T_embedded_init(VEC(T) *v, int reserve); + + These allow the caller to perform the memory allocation. */ + +#define VEC_embedded_size(TDEF,A) (VEC_OP(TDEF,embedded_size)(A)) +#define VEC_embedded_init(TDEF,O,A) (VEC_OP(TDEF,embedded_init)(O,A)) + +/* Determine if a vector has additional capacity. + + int VEC_T_space (VEC(T) *v,int reserve) + + If V has space for RESERVE additional entries, return non-zero. If + RESERVE is < 0, ensure there is at least one space slot. You + usually only need to use this if you are doing your own vector + reallocation, for instance on an embedded vector. This returns + non-zero in exactly the same circumstances that VEC_T_reserve + will. */ + +#define VEC_space(TDEF,V,R) (VEC_OP(TDEF,space)(V,R)) + +/* Reserve space. + int VEC_T_reserve(VEC(T) *&v, int reserve); + + Ensure that V has at least RESERVE slots available, if RESERVE is + >= 0. If RESERVE < 0, ensure that there is at least one spare + slot. These differ in their reallocation behaviour, the first will + not create additional headroom, but the second mechanism will + perform the usual exponential headroom increase. Note this can + cause V to be reallocated. Returns non-zero iff reallocation + actually occurred. */ + +#define VEC_reserve(TDEF,V,R) (VEC_OP(TDEF,reserve)(&(V),R MEM_STAT_INFO)) + +/* Push object with no reallocation + T *VEC_T_quick_push (VEC(T) *v, T obj); // Pointer + T *VEC_T_quick_push (VEC(T) *v, T *obj); // Object + + Push a new element onto the end, returns a pointer to the slot + filled in. For object vectors, the new value can be NULL, in which + case NO initialization is performed. Aborts if there is + insufficient space in the vector. */ + +#define VEC_quick_push(TDEF,V,O) \ + (VEC_OP(TDEF,quick_push)(V,O VEC_CHECK_INFO)) + +/* Push object with reallocation + T *VEC_T_safe_push (VEC(T) *&v, T obj); // Pointer + T *VEC_T_safe_push (VEC(T) *&v, T *obj); // Object + + Push a new element onto the end, returns a pointer to the slot + filled in. For object vectors, the new value can be NULL, in which + case NO initialization is performed. Reallocates V, if needed. */ + +#define VEC_safe_push(TDEF,V,O) \ + (VEC_OP(TDEF,safe_push)(&(V),O VEC_CHECK_INFO MEM_STAT_INFO)) + +/* Pop element off end + T VEC_T_pop (VEC(T) *v); // Pointer + void VEC_T_pop (VEC(T) *v); // Object + + Pop the last element off the end. Returns the element popped, for + pointer vectors. */ + +#define VEC_pop(TDEF,V) (VEC_OP(TDEF,pop)(V VEC_CHECK_INFO)) + +/* Truncate to specific length + void VEC_T_truncate (VEC(T) *v, unsigned len); + + Set the length as specified. This is an O(1) operation. */ + +#define VEC_truncate(TDEF,V,I) \ + (VEC_OP(TDEF,truncate)(V,I VEC_CHECK_INFO)) + +/* Replace element + T VEC_T_replace (VEC(T) *v, unsigned ix, T val); // Pointer + T *VEC_T_replace (VEC(T) *v, unsigned ix, T *val); // Object + + Replace the IXth element of V with a new value, VAL. For pointer + vectors returns the original value. For object vectors returns a + pointer to the new value. For object vectors the new value can be + NULL, in which case no overwriting of the slot is actually + performed. */ + +#define VEC_replace(TDEF,V,I,O) \ + (VEC_OP(TDEF,replace)(V,I,O VEC_CHECK_INFO)) + +/* Insert object with no reallocation + T *VEC_T_quick_insert (VEC(T) *v, unsigned ix, T val); // Pointer + T *VEC_T_quick_insert (VEC(T) *v, unsigned ix, T *val); // Object + + Insert an element, VAL, at the IXth position of V. Return a pointer + to the slot created. For vectors of object, the new value can be + NULL, in which case no initialization of the inserted slot takes + place. Aborts if there is insufficient space. */ + +#define VEC_quick_insert(TDEF,V,I,O) \ + (VEC_OP(TDEF,quick_insert)(V,I,O VEC_CHECK_INFO)) + +/* Insert object with reallocation + T *VEC_T_safe_insert (VEC(T) *&v, unsigned ix, T val); // Pointer + T *VEC_T_safe_insert (VEC(T) *&v, unsigned ix, T *val); // Object + + Insert an element, VAL, at the IXth position of V. Return a pointer + to the slot created. For vectors of object, the new value can be + NULL, in which case no initialization of the inserted slot takes + place. Reallocate V, if necessary. */ + +#define VEC_safe_insert(TDEF,V,I,O) \ + (VEC_OP(TDEF,safe_insert)(&(V),I,O VEC_CHECK_INFO MEM_STAT_INFO)) + +/* Remove element retaining order + T VEC_T_ordered_remove (VEC(T) *v, unsigned ix); // Pointer + void VEC_T_ordered_remove (VEC(T) *v, unsigned ix); // Object + + Remove an element from the IXth position of V. Ordering of + remaining elements is preserverd. For pointer vectors returns the + removed object. This is an O(N) operation due to a memmove. */ + +#define VEC_ordered_remove(TDEF,V,I) \ + (VEC_OP(TDEF,ordered_remove)(V,I VEC_CHECK_INFO)) + +/* Remove element destroying order + T VEC_T_unordered_remove (VEC(T) *v, unsigned ix); // Pointer + void VEC_T_unordered_remove (VEC(T) *v, unsigned ix); // Object + + Remove an element from the IXth position of V. Ordering of + remaining elements is destroyed. For pointer vectors returns the + removed object. This is an O(1) operation. */ + +#define VEC_unordered_remove(TDEF,V,I) \ + (VEC_OP(TDEF,unordered_remove)(V,I VEC_CHECK_INFO)) + +/* Get the address of the array of elements + T *VEC_T_address (VEC(T) v) + + If you need to directly manipulate the array (for instance, you + want to feed it to qsort), use this accessor. */ + +#define VEC_address(TDEF,V) (VEC_OP(TDEF,address)(V)) + +#if !IN_GENGTYPE +/* Reallocate an array of elements with prefix. */ +extern void *vec_p_reserve (void *, int MEM_STAT_DECL); +extern void *vec_o_reserve (void *, int, size_t, size_t MEM_STAT_DECL); + +#if ENABLE_CHECKING +#define VEC_CHECK_INFO ,__FILE__,__LINE__,__FUNCTION__ +#define VEC_CHECK_DECL ,const char *file_,unsigned line_,const char *function_ +#define VEC_CHECK_PASS ,file_,line_,function_ + +#define VEC_ASSERT(EXPR,OP,TDEF) \ + (void)((EXPR) ? 0 : (VEC_ASSERT_FAIL(OP,VEC(TDEF)), 0)) + +extern void vec_assert_fail (const char *, const char * VEC_CHECK_DECL) + ATTRIBUTE_NORETURN; +#define VEC_ASSERT_FAIL(OP,VEC) vec_assert_fail (OP,#VEC VEC_CHECK_PASS) +#else +#define VEC_CHECK_INFO +#define VEC_CHECK_DECL +#define VEC_CHECK_PASS +#define VEC_ASSERT(EXPR,OP,TYPE) (void)(EXPR) +#endif + +#define VEC(TDEF) VEC_##TDEF +#define VEC_OP(TDEF,OP) VEC_OP_(VEC(TDEF),OP) +#define VEC_OP_(VEC,OP) VEC_OP__(VEC,OP) +#define VEC_OP__(VEC,OP) VEC ## _ ## OP +#else /* IN_GENGTYPE */ +#define VEC(TDEF) VEC_ TDEF +#define VEC_STRINGIFY(X) VEC_STRINGIFY_(X) +#define VEC_STRINGIFY_(X) #X +#undef GTY +#endif /* IN_GENGTYPE */ + +#define VEC_TDEF(TDEF) \ +typedef struct VEC (TDEF) GTY(()) \ +{ \ + unsigned num; \ + unsigned alloc; \ + TDEF GTY ((length ("%h.num"))) vec[1]; \ +} VEC (TDEF) + +/* Vector of pointer to object. */ +#if IN_GENGTYPE +{"DEF_VEC_P", VEC_STRINGIFY (VEC_TDEF (#)) ";", NULL}, +#else + +#define DEF_VEC_P(TDEF) \ +VEC_TDEF (TDEF); \ + \ +static inline unsigned VEC_OP (TDEF,length) \ + (const VEC (TDEF) *vec_) \ +{ \ + return vec_ ? vec_->num : 0; \ +} \ + \ +static inline TDEF VEC_OP (TDEF,last) \ + (const VEC (TDEF) *vec_ VEC_CHECK_DECL) \ +{ \ + VEC_ASSERT (vec_ && vec_->num, "last", TDEF); \ + \ + return vec_->vec[vec_->num - 1]; \ +} \ + \ +static inline TDEF VEC_OP (TDEF,index) \ + (const VEC (TDEF) *vec_, unsigned ix_ VEC_CHECK_DECL) \ +{ \ + VEC_ASSERT (vec_ && ix_ < vec_->num, "index", TDEF); \ + \ + return vec_->vec[ix_]; \ +} \ + \ +static inline int VEC_OP (TDEF,iterate) \ + (const VEC (TDEF) *vec_, unsigned ix_, TDEF *ptr) \ +{ \ + if (vec_ && ix_ < vec_->num) \ + { \ + *ptr = vec_->vec[ix_]; \ + return 1; \ + } \ + else \ + { \ + *ptr = 0; \ + return 0; \ + } \ +} \ + \ +static inline VEC (TDEF) *VEC_OP (TDEF,alloc) \ + (int alloc_ MEM_STAT_DECL) \ +{ \ + return (VEC (TDEF) *) vec_p_reserve (NULL, alloc_ - !alloc_ PASS_MEM_STAT);\ +} \ + \ +static inline size_t VEC_OP (TDEF,embedded_size) \ + (int alloc_) \ +{ \ + return offsetof (VEC(TDEF),vec) + alloc_ * sizeof(TDEF); \ +} \ + \ +static inline void VEC_OP (TDEF,embedded_init) \ + (VEC (TDEF) *vec_, int alloc_) \ +{ \ + vec_->num = 0; \ + vec_->alloc = alloc_; \ +} \ + \ +static inline int VEC_OP (TDEF,space) \ + (VEC (TDEF) *vec_, int alloc_) \ +{ \ + return vec_ ? ((vec_)->alloc - (vec_)->num \ + < (unsigned)(alloc_ < 0 ? 1 : alloc_)) : alloc_ != 0; \ +} \ + \ +static inline int VEC_OP (TDEF,reserve) \ + (VEC (TDEF) **vec_, int alloc_ MEM_STAT_DECL) \ +{ \ + int extend = VEC_OP (TDEF,space) (*vec_, alloc_); \ + \ + if (extend) \ + *vec_ = (VEC (TDEF) *) vec_p_reserve (*vec_, alloc_ PASS_MEM_STAT); \ + \ + return extend; \ +} \ + \ +static inline TDEF *VEC_OP (TDEF,quick_push) \ + (VEC (TDEF) *vec_, TDEF obj_ VEC_CHECK_DECL) \ +{ \ + TDEF *slot_; \ + \ + VEC_ASSERT (vec_->num < vec_->alloc, "push", TDEF); \ + slot_ = &vec_->vec[vec_->num++]; \ + *slot_ = obj_; \ + \ + return slot_; \ +} \ + \ +static inline TDEF *VEC_OP (TDEF,safe_push) \ + (VEC (TDEF) **vec_, TDEF obj_ VEC_CHECK_DECL MEM_STAT_DECL) \ +{ \ + VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT); \ + \ + return VEC_OP (TDEF,quick_push) (*vec_, obj_ VEC_CHECK_PASS); \ +} \ + \ +static inline TDEF VEC_OP (TDEF,pop) \ + (VEC (TDEF) *vec_ VEC_CHECK_DECL) \ +{ \ + TDEF obj_; \ + \ + VEC_ASSERT (vec_->num, "pop", TDEF); \ + obj_ = vec_->vec[--vec_->num]; \ + \ + return obj_; \ +} \ + \ +static inline void VEC_OP (TDEF,truncate) \ + (VEC (TDEF) *vec_, unsigned size_ VEC_CHECK_DECL) \ +{ \ + VEC_ASSERT (vec_ ? vec_->num >= size_ : !size_, "truncate", TDEF); \ + if (vec_) \ + vec_->num = size_; \ +} \ + \ +static inline TDEF VEC_OP (TDEF,replace) \ + (VEC (TDEF) *vec_, unsigned ix_, TDEF obj_ VEC_CHECK_DECL) \ +{ \ + TDEF old_obj_; \ + \ + VEC_ASSERT (ix_ < vec_->num, "replace", TDEF); \ + old_obj_ = vec_->vec[ix_]; \ + vec_->vec[ix_] = obj_; \ + \ + return old_obj_; \ +} \ + \ +static inline TDEF *VEC_OP (TDEF,quick_insert) \ + (VEC (TDEF) *vec_, unsigned ix_, TDEF obj_ VEC_CHECK_DECL) \ +{ \ + TDEF *slot_; \ + \ + VEC_ASSERT (vec_->num < vec_->alloc, "insert", TDEF); \ + VEC_ASSERT (ix_ <= vec_->num, "insert", TDEF); \ + slot_ = &vec_->vec[ix_]; \ + memmove (slot_ + 1, slot_, (vec_->num++ - ix_) * sizeof (TDEF)); \ + *slot_ = obj_; \ + \ + return slot_; \ +} \ + \ +static inline TDEF *VEC_OP (TDEF,safe_insert) \ + (VEC (TDEF) **vec_, unsigned ix_, TDEF obj_ \ + VEC_CHECK_DECL MEM_STAT_DECL) \ +{ \ + VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT); \ + \ + return VEC_OP (TDEF,quick_insert) (*vec_, ix_, obj_ VEC_CHECK_PASS); \ +} \ + \ +static inline TDEF VEC_OP (TDEF,ordered_remove) \ + (VEC (TDEF) *vec_, unsigned ix_ VEC_CHECK_DECL) \ +{ \ + TDEF *slot_; \ + TDEF obj_; \ + \ + VEC_ASSERT (ix_ < vec_->num, "remove", TDEF); \ + slot_ = &vec_->vec[ix_]; \ + obj_ = *slot_; \ + memmove (slot_, slot_ + 1, (--vec_->num - ix_) * sizeof (TDEF)); \ + \ + return obj_; \ +} \ + \ +static inline TDEF VEC_OP (TDEF,unordered_remove) \ + (VEC (TDEF) *vec_, unsigned ix_ VEC_CHECK_DECL) \ +{ \ + TDEF *slot_; \ + TDEF obj_; \ + \ + VEC_ASSERT (ix_ < vec_->num, "remove", TDEF); \ + slot_ = &vec_->vec[ix_]; \ + obj_ = *slot_; \ + *slot_ = vec_->vec[--vec_->num]; \ + \ + return obj_; \ +} \ + \ +static inline TDEF *VEC_OP (TDEF,address) \ + (VEC (TDEF) *vec_) \ +{ \ + return vec_ ? vec_->vec : 0; \ +} \ + \ +struct vec_swallow_trailing_semi +#endif + +/* Vector of object. */ +#if IN_GENGTYPE +{"DEF_VEC_O", VEC_STRINGIFY (VEC_TDEF (#)) ";", NULL}, +#else + +#define DEF_VEC_O(TDEF) \ +VEC_TDEF (TDEF); \ + \ +static inline unsigned VEC_OP (TDEF,length) \ + (const VEC (TDEF) *vec_) \ +{ \ + return vec_ ? vec_->num : 0; \ +} \ + \ +static inline TDEF *VEC_OP (TDEF,last) \ + (VEC (TDEF) *vec_ VEC_CHECK_DECL) \ +{ \ + VEC_ASSERT (vec_ && vec_->num, "last", TDEF); \ + \ + return &vec_->vec[vec_->num - 1]; \ +} \ + \ +static inline TDEF *VEC_OP (TDEF,index) \ + (VEC (TDEF) *vec_, unsigned ix_ VEC_CHECK_DECL) \ +{ \ + VEC_ASSERT (vec_ && ix_ < vec_->num, "index", TDEF); \ + \ + return &vec_->vec[ix_]; \ +} \ + \ +static inline int VEC_OP (TDEF,iterate) \ + (VEC (TDEF) *vec_, unsigned ix_, TDEF **ptr) \ +{ \ + if (vec_ && ix_ < vec_->num) \ + { \ + *ptr = &vec_->vec[ix_]; \ + return 1; \ + } \ + else \ + { \ + *ptr = 0; \ + return 0; \ + } \ +} \ + \ +static inline VEC (TDEF) *VEC_OP (TDEF,alloc) \ + (int alloc_ MEM_STAT_DECL) \ +{ \ + return (VEC (TDEF) *) vec_o_reserve (NULL, alloc_ - !alloc_, \ + offsetof (VEC(TDEF),vec), sizeof (TDEF)\ + PASS_MEM_STAT); \ +} \ + \ +static inline size_t VEC_OP (TDEF,embedded_size) \ + (int alloc_) \ +{ \ + return offsetof (VEC(TDEF),vec) + alloc_ * sizeof(TDEF); \ +} \ + \ +static inline void VEC_OP (TDEF,embedded_init) \ + (VEC (TDEF) *vec_, int alloc_) \ +{ \ + vec_->num = 0; \ + vec_->alloc = alloc_; \ +} \ + \ +static inline int VEC_OP (TDEF,space) \ + (VEC (TDEF) *vec_, int alloc_) \ +{ \ + return vec_ ? ((vec_)->alloc - (vec_)->num \ + < (unsigned)(alloc_ < 0 ? 1 : alloc_)) : alloc_ != 0; \ +} \ + \ +static inline int VEC_OP (TDEF,reserve) \ + (VEC (TDEF) **vec_, int alloc_ MEM_STAT_DECL) \ +{ \ + int extend = VEC_OP (TDEF,space) (*vec_, alloc_); \ + \ + if (extend) \ + *vec_ = (VEC (TDEF) *) vec_o_reserve (*vec_, alloc_, \ + offsetof (VEC(TDEF),vec), sizeof (TDEF) \ + PASS_MEM_STAT); \ + \ + return extend; \ +} \ + \ +static inline TDEF *VEC_OP (TDEF,quick_push) \ + (VEC (TDEF) *vec_, const TDEF *obj_ VEC_CHECK_DECL) \ +{ \ + TDEF *slot_; \ + \ + VEC_ASSERT (vec_->num < vec_->alloc, "push", TDEF); \ + slot_ = &vec_->vec[vec_->num++]; \ + if (obj_) \ + *slot_ = *obj_; \ + \ + return slot_; \ +} \ + \ +static inline TDEF *VEC_OP (TDEF,safe_push) \ + (VEC (TDEF) **vec_, const TDEF *obj_ VEC_CHECK_DECL MEM_STAT_DECL) \ +{ \ + VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT); \ + \ + return VEC_OP (TDEF,quick_push) (*vec_, obj_ VEC_CHECK_PASS); \ +} \ + \ +static inline void VEC_OP (TDEF,pop) \ + (VEC (TDEF) *vec_ VEC_CHECK_DECL) \ +{ \ + VEC_ASSERT (vec_->num, "pop", TDEF); \ + --vec_->num; \ +} \ + \ +static inline void VEC_OP (TDEF,truncate) \ + (VEC (TDEF) *vec_, unsigned size_ VEC_CHECK_DECL) \ +{ \ + VEC_ASSERT (vec_ ? vec_->num >= size_ : !size_, "truncate", TDEF); \ + if (vec_) \ + vec_->num = size_; \ +} \ + \ +static inline TDEF *VEC_OP (TDEF,replace) \ + (VEC (TDEF) *vec_, unsigned ix_, const TDEF *obj_ VEC_CHECK_DECL) \ +{ \ + TDEF *slot_; \ + \ + VEC_ASSERT (ix_ < vec_->num, "replace", TDEF); \ + slot_ = &vec_->vec[ix_]; \ + if (obj_) \ + *slot_ = *obj_; \ + \ + return slot_; \ +} \ + \ +static inline TDEF *VEC_OP (TDEF,quick_insert) \ + (VEC (TDEF) *vec_, unsigned ix_, const TDEF *obj_ VEC_CHECK_DECL) \ +{ \ + TDEF *slot_; \ + \ + VEC_ASSERT (vec_->num < vec_->alloc, "insert", TDEF); \ + VEC_ASSERT (ix_ <= vec_->num, "insert", TDEF); \ + slot_ = &vec_->vec[ix_]; \ + memmove (slot_ + 1, slot_, (vec_->num++ - ix_) * sizeof (TDEF)); \ + if (obj_) \ + *slot_ = *obj_; \ + \ + return slot_; \ +} \ + \ +static inline TDEF *VEC_OP (TDEF,safe_insert) \ + (VEC (TDEF) **vec_, unsigned ix_, const TDEF *obj_ \ + VEC_CHECK_DECL MEM_STAT_DECL) \ +{ \ + VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT); \ + \ + return VEC_OP (TDEF,quick_insert) (*vec_, ix_, obj_ VEC_CHECK_PASS); \ +} \ + \ +static inline void VEC_OP (TDEF,ordered_remove) \ + (VEC (TDEF) *vec_, unsigned ix_ VEC_CHECK_DECL) \ +{ \ + TDEF *slot_; \ + \ + VEC_ASSERT (ix_ < vec_->num, "remove", TDEF); \ + slot_ = &vec_->vec[ix_]; \ + memmove (slot_, slot_ + 1, (--vec_->num - ix_) * sizeof (TDEF)); \ +} \ + \ +static inline void VEC_OP (TDEF,unordered_remove) \ + (VEC (TDEF) *vec_, unsigned ix_ VEC_CHECK_DECL) \ +{ \ + VEC_ASSERT (ix_ < vec_->num, "remove", TDEF); \ + vec_->vec[ix_] = vec_->vec[--vec_->num]; \ +} \ + \ +static inline TDEF *VEC_OP (TDEF,address) \ + (VEC (TDEF) *vec_) \ +{ \ + return vec_ ? vec_->vec : 0; \ +} \ + \ +struct vec_swallow_trailing_semi +#endif + +#endif /* GCC_VEC_H */ diff --git a/libjava/testsuite/libjava.compile/PR16701.java b/libjava/testsuite/libjava.compile/PR16701.java new file mode 100644 index 00000000000..60d459a69c7 --- /dev/null +++ b/libjava/testsuite/libjava.compile/PR16701.java @@ -0,0 +1,10 @@ +class Cl +{ + private static final int CONSTANT1 = 0x001; + public static final int CONSTANT2 = 0x002 >> CONSTANT1; +} + +public class PR16701 +{ + public static final int VALUE = Cl.CONSTANT2; +} diff --git a/libstdc++-v3/testsuite/23_containers/deque/explicit_instantiation.cc b/libstdc++-v3/testsuite/23_containers/deque/explicit_instantiation.cc new file mode 100644 index 00000000000..e6e758d0c74 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/explicit_instantiation.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2004 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) +// any later version. + +// This library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// This file tests explicit instantiation of library containers + +#include <deque> + +// { dg-do compile } + +template class std::deque<int>; diff --git a/libstdc++-v3/testsuite/23_containers/list/explicit_instantiation.cc b/libstdc++-v3/testsuite/23_containers/list/explicit_instantiation.cc new file mode 100644 index 00000000000..2c9db8d3f86 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/explicit_instantiation.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2004 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) +// any later version. + +// This library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// This file tests explicit instantiation of library containers + +#include <list> + +// { dg-do compile } + +template class std::list<int>; diff --git a/libstdc++-v3/testsuite/23_containers/map/explicit_instantiation.cc b/libstdc++-v3/testsuite/23_containers/map/explicit_instantiation.cc new file mode 100644 index 00000000000..4ceb2501569 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/map/explicit_instantiation.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2004 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) +// any later version. + +// This library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// This file tests explicit instantiation of library containers + +#include <map> + +// { dg-do compile } + +template class std::map<int, double>; diff --git a/libstdc++-v3/testsuite/23_containers/multimap/explicit_instantiation.cc b/libstdc++-v3/testsuite/23_containers/multimap/explicit_instantiation.cc new file mode 100644 index 00000000000..4a740b250f6 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multimap/explicit_instantiation.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2004 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) +// any later version. + +// This library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// This file tests explicit instantiation of library containers + +#include <map> + +// { dg-do compile } + +template class std::multimap<int, double>; diff --git a/libstdc++-v3/testsuite/23_containers/multiset/explicit_instantiation.cc b/libstdc++-v3/testsuite/23_containers/multiset/explicit_instantiation.cc new file mode 100644 index 00000000000..fb6b5f1db19 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/explicit_instantiation.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2004 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) +// any later version. + +// This library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// This file tests explicit instantiation of library containers + +#include <set> + +// { dg-do compile } + +template class std::multiset<int>; diff --git a/libstdc++-v3/testsuite/23_containers/set/explicit_instantiation.cc b/libstdc++-v3/testsuite/23_containers/set/explicit_instantiation.cc new file mode 100644 index 00000000000..02e33be0456 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/explicit_instantiation.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2004 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) +// any later version. + +// This library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// This file tests explicit instantiation of library containers + +#include <set> + +// { dg-do compile } + +template class std::set<int>; diff --git a/libstdc++-v3/testsuite/23_containers/vector/explicit_instantiation.cc b/libstdc++-v3/testsuite/23_containers/vector/explicit_instantiation.cc new file mode 100644 index 00000000000..0668bbd12ab --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/explicit_instantiation.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2004 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) +// any later version. + +// This library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// This file tests explicit instantiation of library containers + +#include <vector> + +// { dg-do compile } + +template class std::vector<int>; diff --git a/libstdc++-v3/testsuite/ext/hash_set_explicit_instantiation.cc b/libstdc++-v3/testsuite/ext/hash_set_explicit_instantiation.cc new file mode 100644 index 00000000000..e59a1525008 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/hash_set_explicit_instantiation.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2004 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) +// any later version. + +// This library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// This file tests explicit instantiation of library containers + +#include <ext/hash_set> + +// { dg-do compile } + +template class __gnu_cxx::hash_set<int>; diff --git a/libstdc++-v3/testsuite/ext/slist_explicit_instantiation.cc b/libstdc++-v3/testsuite/ext/slist_explicit_instantiation.cc new file mode 100644 index 00000000000..e31f526380e --- /dev/null +++ b/libstdc++-v3/testsuite/ext/slist_explicit_instantiation.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2004 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) +// any later version. + +// This library 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 library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// This file tests explicit instantiation of library containers + +#include <ext/slist> + +// { dg-do compile } + +template class __gnu_cxx::slist<int>; |