mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-14 12:40:23 +08:00
struct-layout-1.exp: New file.
* g++.dg/compat/struct-layout-1.exp: New file. * g++.dg/compat/struct-layout-1.h: New. * g++.dg/compat/struct-layout-1_generate.c: New. * g++.dg/compat/struct-layout-1_x1.h: New. * g++.dg/compat/struct-layout-1_x2.h: New. * g++.dg/compat/struct-layout-1_y1.h: New. * g++.dg/compat/struct-layout-1_y2.h: New. From-SVN: r108244
This commit is contained in:
parent
88a6bf5e19
commit
e729a3855f
@ -1,5 +1,13 @@
|
||||
2005-12-08 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* g++.dg/compat/struct-layout-1.exp: New file.
|
||||
* g++.dg/compat/struct-layout-1.h: New.
|
||||
* g++.dg/compat/struct-layout-1_generate.c: New.
|
||||
* g++.dg/compat/struct-layout-1_x1.h: New.
|
||||
* g++.dg/compat/struct-layout-1_x2.h: New.
|
||||
* g++.dg/compat/struct-layout-1_y1.h: New.
|
||||
* g++.dg/compat/struct-layout-1_y2.h: New.
|
||||
|
||||
* gcc.dg/20050330-2.c: New test.
|
||||
|
||||
2005-12-08 Erik Edelmann <eedelman@gcc.gnu.org>
|
||||
|
164
gcc/testsuite/g++.dg/compat/struct-layout-1.exp
Normal file
164
gcc/testsuite/g++.dg/compat/struct-layout-1.exp
Normal file
@ -0,0 +1,164 @@
|
||||
# Copyright (C) 2002, 2003, 2004, 2005 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, 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_CXX_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 GXX_UNDER_TEST
|
||||
global ld_library_path
|
||||
|
||||
# Load procedures from common libraries.
|
||||
load_lib standard.exp
|
||||
load_lib g++.exp
|
||||
load_lib target-libpath.exp
|
||||
|
||||
#
|
||||
# compat-use-alt-compiler -- make the alternate compiler the default
|
||||
#
|
||||
proc compat-use-alt-compiler { } {
|
||||
global GXX_UNDER_TEST ALT_CXX_UNDER_TEST
|
||||
global CXXFLAGS
|
||||
global ALWAYS_CXXFLAGS
|
||||
global ld_library_path alt_ld_library_path
|
||||
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 GXX_UNDER_TEST $ALT_CXX_UNDER_TEST
|
||||
set CXXFLAGS ""
|
||||
set ALWAYS_CXXFLAGS ""
|
||||
set ld_library_path $alt_ld_library_path
|
||||
set_ld_library_path_env_vars
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# compat-use-tst-compiler -- make compiler under test the default
|
||||
#
|
||||
proc compat-use-tst-compiler { } {
|
||||
global GXX_UNDER_TEST save_gxx_under_test
|
||||
global CXXFLAGS save_cxxflags
|
||||
global ALWAYS_CXXFLAGS save_always_cxxflags
|
||||
global ld_library_path save_ld_library_path
|
||||
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 GXX_UNDER_TEST $save_gxx_under_test
|
||||
set CXXFLAGS $save_cxxflags
|
||||
set ALWAYS_CXXFLAGS $save_always_cxxflags
|
||||
set ld_library_path $save_ld_library_path
|
||||
set_ld_library_path_env_vars
|
||||
}
|
||||
}
|
||||
|
||||
# Load the language-independent compabibility support procedures.
|
||||
# This must be done after the compat-use-*-compiler definitions.
|
||||
load_lib compat.exp
|
||||
|
||||
g++_init
|
||||
|
||||
# Save variables for the C++ compiler under test, which each test will
|
||||
# change a couple of times. This must be done after calling g++-init.
|
||||
set save_gxx_under_test $GXX_UNDER_TEST
|
||||
set save_cxxflags $CXXFLAGS
|
||||
set save_always_cxxflags $ALWAYS_CXXFLAGS
|
||||
set save_ld_library_path $ld_library_path
|
||||
|
||||
# Define an identifier for use with this suite to avoid name conflicts
|
||||
# with other compat tests running at the same time.
|
||||
set sid "cp_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
|
||||
set alt_ld_library_path "."
|
||||
if [info exists ALT_CXX_UNDER_TEST] then {
|
||||
set use_alt 1
|
||||
if [string match "same" $ALT_CXX_UNDER_TEST] then {
|
||||
set same_alt 1
|
||||
} else {
|
||||
if [info exists ALT_LD_LIBRARY_PATH] then {
|
||||
append alt_ld_library_path ":${ALT_LD_LIBRARY_PATH}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set tstobjdir "$tmpdir/g++.dg-struct-layout-1"
|
||||
set generator "$tmpdir/g++.dg-struct-layout-1_generate"
|
||||
|
||||
set generator_src "$srcdir/$subdir/struct-layout-1_generate.c"
|
||||
set generator_src "$generator_src $srcdir/$subdir/../../gcc.dg/compat/generate-random.c"
|
||||
set generator_src "$generator_src $srcdir/$subdir/../../gcc.dg/compat/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 g++.dg/compat/struct-layout-1 generator"
|
||||
}
|
||||
} else {
|
||||
warning "Could not compile g++.dg/compat/struct-layout-1 generator"
|
||||
}
|
||||
|
||||
# Restore the original compiler under test.
|
||||
compat-use-tst-compiler
|
497
gcc/testsuite/g++.dg/compat/struct-layout-1.h
Normal file
497
gcc/testsuite/g++.dg/compat/struct-layout-1.h
Normal file
@ -0,0 +1,497 @@
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "../../gcc.dg/compat/compat-common.h"
|
||||
|
||||
#ifndef SKIP_ATTRIBUTE
|
||||
# include "../../gcc.dg/compat/vector-defs.h"
|
||||
#else
|
||||
typedef int qi;
|
||||
typedef int hi;
|
||||
typedef int si;
|
||||
typedef int di;
|
||||
typedef float sf;
|
||||
typedef float df;
|
||||
typedef int v8qi;
|
||||
typedef int v16qi;
|
||||
typedef int v2hi;
|
||||
typedef int v4hi;
|
||||
typedef int v8hi;
|
||||
typedef int v2si;
|
||||
typedef int v4si;
|
||||
typedef int v1di;
|
||||
typedef int v2di;
|
||||
typedef int v2sf;
|
||||
typedef int v4sf;
|
||||
typedef int v16sf;
|
||||
typedef int v2df;
|
||||
typedef int u8qi;
|
||||
typedef int u16qi;
|
||||
typedef int u2hi;
|
||||
typedef int u4hi;
|
||||
typedef int u8hi;
|
||||
typedef int u2si;
|
||||
typedef int u4si;
|
||||
typedef int u1di;
|
||||
typedef int u2di;
|
||||
typedef int u2sf;
|
||||
typedef int u4sf;
|
||||
typedef int u16sf;
|
||||
typedef int u2df;
|
||||
#endif
|
||||
#if (defined __i386__ || defined __x86_64__) && !defined SKIP_ATTRIBUTE
|
||||
# ifdef __MMX__
|
||||
# include <mmintrin.h>
|
||||
# else
|
||||
typedef int __m64;
|
||||
# endif
|
||||
# ifdef __SSE__
|
||||
# include <xmmintrin.h>
|
||||
# else
|
||||
typedef int __m128;
|
||||
# endif
|
||||
#else
|
||||
typedef int __m64;
|
||||
typedef int __m128;
|
||||
#endif
|
||||
|
||||
#define FLDS_MAX 32
|
||||
extern struct Info
|
||||
{
|
||||
int nfields, nbitfields;
|
||||
void *sp, *a0p, *a3p;
|
||||
void *flds[FLDS_MAX];
|
||||
size_t sz, sizes[FLDS_MAX];
|
||||
size_t als, ala0, ala3, aligns[FLDS_MAX];
|
||||
} info;
|
||||
|
||||
extern int intarray[256];
|
||||
extern int fn0 (void), fn1 (void), fn2 (void), fn3 (void), fn4 (void);
|
||||
extern int fn5 (void), fn6 (void), fn7 (void), fn8 (void), fn9 (void);
|
||||
|
||||
#ifdef DBG
|
||||
#define FAIL(n, m) printf ("fail %d.%d\n", n, m), ++fails
|
||||
#else
|
||||
#define FAIL(n, m) ++fails
|
||||
#endif
|
||||
|
||||
#ifdef SKIP_ATTRIBUTE
|
||||
# define __attribute__(x)
|
||||
#endif
|
||||
#define atal __attribute__((aligned))
|
||||
#define atpa __attribute__((packed))
|
||||
#define atalpa __attribute__((aligned, packed))
|
||||
#define atpaal __attribute__((packed, aligned))
|
||||
#define atal1 __attribute__((aligned (1)))
|
||||
#define atal2 __attribute__((aligned (2)))
|
||||
#define atal4 __attribute__((aligned (4)))
|
||||
#define atal8 __attribute__((aligned (8)))
|
||||
#define atal16 __attribute__((aligned (16)))
|
||||
#define atal1pa __attribute__((aligned (1), packed))
|
||||
#define atal2pa __attribute__((aligned (2), packed))
|
||||
#define atal4pa __attribute__((aligned (4), packed))
|
||||
#define atal8pa __attribute__((aligned (8), packed))
|
||||
#define atal16pa __attribute__((aligned (16), packed))
|
||||
#define atpaal1 __attribute__((packed, aligned (1)))
|
||||
#define atpaal2 __attribute__((packed, aligned (2)))
|
||||
#define atpaal4 __attribute__((packed, aligned (4)))
|
||||
#define atpaal8 __attribute__((packed, aligned (8)))
|
||||
#define atpaal16 __attribute__((packed, aligned (16)))
|
||||
|
||||
#if UCHAR_MAX == 255 && USHORT_MAX == 65535 && UINT_MAX == 4294967295U \
|
||||
&& ULLONG_MAX == 18446744073709551615ULL
|
||||
/* For ILP32 and LP64 targets, assume float is at least 32-bit
|
||||
and double plus long double at least 64-bit. */
|
||||
# define atalx1 atal1
|
||||
# define atalx2 atal2
|
||||
# define atalx4 atal4
|
||||
# define atalx8 atal8
|
||||
# define atalx16 atal16
|
||||
# define atalx1pa atal1pa
|
||||
# define atalx2pa atal2pa
|
||||
# define atalx4pa atal4pa
|
||||
# define atalx8pa atal8pa
|
||||
# define atalx16pa atal16pa
|
||||
# define atpaalx1 atpaal1
|
||||
# define atpaalx2 atpaal2
|
||||
# define atpaalx4 atpaal4
|
||||
# define atpaalx8 atpaal8
|
||||
# define atpaalx16 atpaal16
|
||||
# if ULONG_MAX > 4294967295UL
|
||||
# define ataly8 atal8
|
||||
# define ataly8pa atal8pa
|
||||
# define atpaaly8 atpaal8
|
||||
# define ataly16 atal16
|
||||
# define ataly16pa atal16pa
|
||||
# define atpaaly16 atpaal16
|
||||
# else
|
||||
# define ataly8
|
||||
# define ataly8pa
|
||||
# define atpaaly8
|
||||
# define ataly16
|
||||
# define ataly16pa
|
||||
# define atpaaly16
|
||||
# endif
|
||||
#else
|
||||
# define atalx1
|
||||
# define atalx2
|
||||
# define atalx4
|
||||
# define atalx8
|
||||
# define atalx16
|
||||
# define atalx1pa
|
||||
# define atalx2pa
|
||||
# define atalx4pa
|
||||
# define atalx8pa
|
||||
# define atalx16pa
|
||||
# define atpaalx1
|
||||
# define atpaalx2
|
||||
# define atpaalx4
|
||||
# define atpaalx8
|
||||
# define atpaalx16
|
||||
# define ataly8
|
||||
# define ataly8pa
|
||||
# define atpaaly8
|
||||
# define ataly16
|
||||
# define ataly16pa
|
||||
# define atpaaly16
|
||||
#endif
|
||||
|
||||
#define atQI __attribute__((mode (QI)))
|
||||
#define atHI __attribute__((mode (HI)))
|
||||
#define atSI __attribute__((mode (SI)))
|
||||
#define atDI __attribute__((mode (DI)))
|
||||
|
||||
enum E0 { e0_0 };
|
||||
enum E1 { e1_0, e1_1 };
|
||||
enum E2 { e2_m3 = -3, e2_m2, e2_m1, e2_0, e2_1, e2_2, e2_3 };
|
||||
enum E3 { e3_m127 = -127, e3_m126, e3_m125, e3_0 = 0, e3_125 = 125, e3_126, e3_127 };
|
||||
enum E4 { e4_0, e4_1, e4_2, e4_3, e4_253 = 253, e4_254, e4_255 };
|
||||
enum E5 { e5_m32767 = -32767, e5_m32766, e5_m32765, e5_0 = 0, e5_32765 = 32765, e5_32766, e5_32767 };
|
||||
enum E6 { e6_0, e6_1, e6_2, e6_3, e6_65533 = 65533, e6_65534, e6_65535 };
|
||||
enum E7 { e7_m2147483647 = -2147483647, e7_m2147483646, e7_m2147483645,
|
||||
e7_0, e7_2147483645 = 2147483645, e7_2147483646, e7_2147483647 };
|
||||
enum E8 { e8_0, e8_1, e8_2, e8_3, e8_4294967293 = 4294967293U, e8_4294967294, e8_4294967295 };
|
||||
enum E9 { e9_m1099511627775 = -1099511627775LL, e9_m1099511627774, e9_m1099511627773,
|
||||
e9_0, e9_1099511627773 = 1099511627773LL, e9_1099511627774, e9_1099511627775 };
|
||||
|
||||
typedef char Tchar;
|
||||
typedef signed char Tschar;
|
||||
typedef unsigned char Tuchar;
|
||||
typedef short int Tshort;
|
||||
typedef unsigned short int Tushort;
|
||||
typedef int Tint;
|
||||
typedef unsigned int Tuint;
|
||||
typedef long int Tlong;
|
||||
typedef unsigned long int Tulong;
|
||||
typedef long long int Tllong;
|
||||
typedef unsigned long long int Tullong;
|
||||
typedef float Tfloat;
|
||||
typedef double Tdouble;
|
||||
typedef long double Tldouble;
|
||||
typedef _Complex float Tcfloat;
|
||||
typedef _Complex double Tcdouble;
|
||||
typedef _Complex long double Tcldouble;
|
||||
typedef bool Tbool;
|
||||
typedef enum E0 TE0;
|
||||
typedef enum E1 TE1;
|
||||
typedef enum E2 TE2;
|
||||
typedef enum E3 TE3;
|
||||
typedef enum E4 TE4;
|
||||
typedef enum E5 TE5;
|
||||
typedef enum E6 TE6;
|
||||
typedef enum E7 TE7;
|
||||
typedef enum E8 TE8;
|
||||
typedef enum E9 TE9;
|
||||
typedef void *Tptr;
|
||||
typedef char *Tcptr;
|
||||
typedef int *Tiptr;
|
||||
typedef char Talchar atal;
|
||||
typedef signed char Talschar atal;
|
||||
typedef unsigned char Taluchar atal;
|
||||
typedef short int Talshort atal;
|
||||
typedef unsigned short int Talushort atal;
|
||||
typedef int Talint atal;
|
||||
typedef unsigned int Taluint atal;
|
||||
typedef long int Tallong atal;
|
||||
typedef unsigned long int Talulong atal;
|
||||
typedef long long int Talllong atal;
|
||||
typedef unsigned long long int Talullong atal;
|
||||
typedef float Talfloat atal;
|
||||
typedef double Taldouble atal;
|
||||
typedef long double Talldouble atal;
|
||||
typedef _Complex float Talcfloat atal;
|
||||
typedef _Complex double Talcdouble atal;
|
||||
typedef _Complex long double Talcldouble atal;
|
||||
typedef bool Talbool atal;
|
||||
typedef enum E0 TalE0 atal;
|
||||
typedef enum E1 TalE1 atal;
|
||||
typedef enum E2 TalE2 atal;
|
||||
typedef enum E3 TalE3 atal;
|
||||
typedef enum E4 TalE4 atal;
|
||||
typedef enum E5 TalE5 atal;
|
||||
typedef enum E6 TalE6 atal;
|
||||
typedef enum E7 TalE7 atal;
|
||||
typedef enum E8 TalE8 atal;
|
||||
typedef enum E9 TalE9 atal;
|
||||
typedef void *Talptr atal;
|
||||
typedef char *Talcptr atal;
|
||||
typedef int *Taliptr atal;
|
||||
typedef char Tal1char atal1;
|
||||
typedef signed char Tal1schar atal1;
|
||||
typedef unsigned char Tal1uchar atal1;
|
||||
typedef short int Tal1short atal1;
|
||||
typedef unsigned short int Tal1ushort atal1;
|
||||
typedef int Tal1int atal1;
|
||||
typedef unsigned int Tal1uint atal1;
|
||||
typedef long int Tal1long atal1;
|
||||
typedef unsigned long int Tal1ulong atal1;
|
||||
typedef long long int Tal1llong atal1;
|
||||
typedef unsigned long long int Tal1ullong atal1;
|
||||
typedef float Tal1float atal1;
|
||||
typedef double Tal1double atal1;
|
||||
typedef long double Tal1ldouble atal1;
|
||||
typedef _Complex float Tal1cfloat atal1;
|
||||
typedef _Complex double Tal1cdouble atal1;
|
||||
typedef _Complex long double Tal1cldouble atal1;
|
||||
typedef bool Tal1bool atal1;
|
||||
typedef enum E0 Tal1E0 atal1;
|
||||
typedef enum E1 Tal1E1 atal1;
|
||||
typedef enum E2 Tal1E2 atal1;
|
||||
typedef enum E3 Tal1E3 atal1;
|
||||
typedef enum E4 Tal1E4 atal1;
|
||||
typedef enum E5 Tal1E5 atal1;
|
||||
typedef enum E6 Tal1E6 atal1;
|
||||
typedef enum E7 Tal1E7 atal1;
|
||||
typedef enum E8 Tal1E8 atal1;
|
||||
typedef enum E9 Tal1E9 atal1;
|
||||
typedef void *Tal1ptr atal1;
|
||||
typedef char *Tal1cptr atal1;
|
||||
typedef int *Tal1iptr atal1;
|
||||
typedef char Tal2char atal2;
|
||||
typedef signed char Tal2schar atal2;
|
||||
typedef unsigned char Tal2uchar atal2;
|
||||
typedef short int Tal2short atal2;
|
||||
typedef unsigned short int Tal2ushort atal2;
|
||||
typedef int Tal2int atal2;
|
||||
typedef unsigned int Tal2uint atal2;
|
||||
typedef long int Tal2long atal2;
|
||||
typedef unsigned long int Tal2ulong atal2;
|
||||
typedef long long int Tal2llong atal2;
|
||||
typedef unsigned long long int Tal2ullong atal2;
|
||||
typedef float Tal2float atal2;
|
||||
typedef double Tal2double atal2;
|
||||
typedef long double Tal2ldouble atal2;
|
||||
typedef _Complex float Tal2cfloat atal2;
|
||||
typedef _Complex double Tal2cdouble atal2;
|
||||
typedef _Complex long double Tal2cldouble atal2;
|
||||
typedef bool Tal2bool atal2;
|
||||
typedef enum E0 Tal2E0 atal2;
|
||||
typedef enum E1 Tal2E1 atal2;
|
||||
typedef enum E2 Tal2E2 atal2;
|
||||
typedef enum E3 Tal2E3 atal2;
|
||||
typedef enum E4 Tal2E4 atal2;
|
||||
typedef enum E5 Tal2E5 atal2;
|
||||
typedef enum E6 Tal2E6 atal2;
|
||||
typedef enum E7 Tal2E7 atal2;
|
||||
typedef enum E8 Tal2E8 atal2;
|
||||
typedef enum E9 Tal2E9 atal2;
|
||||
typedef void *Tal2ptr atal2;
|
||||
typedef char *Tal2cptr atal2;
|
||||
typedef int *Tal2iptr atal2;
|
||||
typedef char Tal4char atal4;
|
||||
typedef signed char Tal4schar atal4;
|
||||
typedef unsigned char Tal4uchar atal4;
|
||||
typedef short int Tal4short atal4;
|
||||
typedef unsigned short int Tal4ushort atal4;
|
||||
typedef int Tal4int atal4;
|
||||
typedef unsigned int Tal4uint atal4;
|
||||
typedef long int Tal4long atal4;
|
||||
typedef unsigned long int Tal4ulong atal4;
|
||||
typedef long long int Tal4llong atal4;
|
||||
typedef unsigned long long int Tal4ullong atal4;
|
||||
typedef float Tal4float atal4;
|
||||
typedef double Tal4double atal4;
|
||||
typedef long double Tal4ldouble atal4;
|
||||
typedef _Complex float Tal4cfloat atal4;
|
||||
typedef _Complex double Tal4cdouble atal4;
|
||||
typedef _Complex long double Tal4cldouble atal4;
|
||||
typedef bool Tal4bool atal4;
|
||||
typedef enum E0 Tal4E0 atal4;
|
||||
typedef enum E1 Tal4E1 atal4;
|
||||
typedef enum E2 Tal4E2 atal4;
|
||||
typedef enum E3 Tal4E3 atal4;
|
||||
typedef enum E4 Tal4E4 atal4;
|
||||
typedef enum E5 Tal4E5 atal4;
|
||||
typedef enum E6 Tal4E6 atal4;
|
||||
typedef enum E7 Tal4E7 atal4;
|
||||
typedef enum E8 Tal4E8 atal4;
|
||||
typedef enum E9 Tal4E9 atal4;
|
||||
typedef void *Tal4ptr atal4;
|
||||
typedef char *Tal4cptr atal4;
|
||||
typedef int *Tal4iptr atal4;
|
||||
typedef char Tal8char atal8;
|
||||
typedef signed char Tal8schar atal8;
|
||||
typedef unsigned char Tal8uchar atal8;
|
||||
typedef short int Tal8short atal8;
|
||||
typedef unsigned short int Tal8ushort atal8;
|
||||
typedef int Tal8int atal8;
|
||||
typedef unsigned int Tal8uint atal8;
|
||||
typedef long int Tal8long atal8;
|
||||
typedef unsigned long int Tal8ulong atal8;
|
||||
typedef long long int Tal8llong atal8;
|
||||
typedef unsigned long long int Tal8ullong atal8;
|
||||
typedef float Tal8float atal8;
|
||||
typedef double Tal8double atal8;
|
||||
typedef long double Tal8ldouble atal8;
|
||||
typedef _Complex float Tal8cfloat atal8;
|
||||
typedef _Complex double Tal8cdouble atal8;
|
||||
typedef _Complex long double Tal8cldouble atal8;
|
||||
typedef bool Tal8bool atal8;
|
||||
typedef enum E0 Tal8E0 atal8;
|
||||
typedef enum E1 Tal8E1 atal8;
|
||||
typedef enum E2 Tal8E2 atal8;
|
||||
typedef enum E3 Tal8E3 atal8;
|
||||
typedef enum E4 Tal8E4 atal8;
|
||||
typedef enum E5 Tal8E5 atal8;
|
||||
typedef enum E6 Tal8E6 atal8;
|
||||
typedef enum E7 Tal8E7 atal8;
|
||||
typedef enum E8 Tal8E8 atal8;
|
||||
typedef enum E9 Tal8E9 atal8;
|
||||
typedef void *Tal8ptr atal8;
|
||||
typedef char *Tal8cptr atal8;
|
||||
typedef int *Tal8iptr atal8;
|
||||
typedef char Tal16char atal16;
|
||||
typedef signed char Tal16schar atal16;
|
||||
typedef unsigned char Tal16uchar atal16;
|
||||
typedef short int Tal16short atal16;
|
||||
typedef unsigned short int Tal16ushort atal16;
|
||||
typedef int Tal16int atal16;
|
||||
typedef unsigned int Tal16uint atal16;
|
||||
typedef long int Tal16long atal16;
|
||||
typedef unsigned long int Tal16ulong atal16;
|
||||
typedef long long int Tal16llong atal16;
|
||||
typedef unsigned long long int Tal16ullong atal16;
|
||||
typedef float Tal16float atal16;
|
||||
typedef double Tal16double atal16;
|
||||
typedef long double Tal16ldouble atal16;
|
||||
typedef _Complex float Tal16cfloat atal16;
|
||||
typedef _Complex double Tal16cdouble atal16;
|
||||
typedef _Complex long double Tal16cldouble atal16;
|
||||
typedef bool Tal16bool atal16;
|
||||
typedef enum E0 Tal16E0 atal16;
|
||||
typedef enum E1 Tal16E1 atal16;
|
||||
typedef enum E2 Tal16E2 atal16;
|
||||
typedef enum E3 Tal16E3 atal16;
|
||||
typedef enum E4 Tal16E4 atal16;
|
||||
typedef enum E5 Tal16E5 atal16;
|
||||
typedef enum E6 Tal16E6 atal16;
|
||||
typedef enum E7 Tal16E7 atal16;
|
||||
typedef enum E8 Tal16E8 atal16;
|
||||
typedef enum E9 Tal16E9 atal16;
|
||||
typedef void *Tal16ptr atal16;
|
||||
typedef char *Tal16cptr atal16;
|
||||
typedef int *Tal16iptr atal16;
|
||||
typedef char Talx1char atalx1;
|
||||
typedef signed char Talx1schar atalx1;
|
||||
typedef unsigned char Talx1uchar atalx1;
|
||||
typedef short int Talx1short atalx1;
|
||||
typedef unsigned short int Talx1ushort atalx1;
|
||||
typedef int Talx1int atalx1;
|
||||
typedef unsigned int Talx1uint atalx1;
|
||||
typedef long int Talx1long atalx1;
|
||||
typedef unsigned long int Talx1ulong atalx1;
|
||||
typedef long long int Talx1llong atalx1;
|
||||
typedef unsigned long long int Talx1ullong atalx1;
|
||||
typedef float Talx1float atalx1;
|
||||
typedef double Talx1double atalx1;
|
||||
typedef long double Talx1ldouble atalx1;
|
||||
typedef _Complex float Talx1cfloat atalx1;
|
||||
typedef _Complex double Talx1cdouble atalx1;
|
||||
typedef _Complex long double Talx1cldouble atalx1;
|
||||
typedef bool Talx1bool atalx1;
|
||||
typedef enum E0 Talx1E0 atalx1;
|
||||
typedef enum E1 Talx1E1 atalx1;
|
||||
typedef enum E2 Talx1E2 atalx1;
|
||||
typedef enum E3 Talx1E3 atalx1;
|
||||
typedef enum E4 Talx1E4 atalx1;
|
||||
typedef enum E5 Talx1E5 atalx1;
|
||||
typedef enum E6 Talx1E6 atalx1;
|
||||
typedef enum E7 Talx1E7 atalx1;
|
||||
typedef enum E8 Talx1E8 atalx1;
|
||||
typedef enum E9 Talx1E9 atalx1;
|
||||
typedef void *Talx1ptr atalx1;
|
||||
typedef char *Talx1cptr atalx1;
|
||||
typedef int *Talx1iptr atalx1;
|
||||
typedef short int Talx2short atalx2;
|
||||
typedef unsigned short int Talx2ushort atalx2;
|
||||
typedef int Talx2int atalx2;
|
||||
typedef unsigned int Talx2uint atalx2;
|
||||
typedef long int Talx2long atalx2;
|
||||
typedef unsigned long int Talx2ulong atalx2;
|
||||
typedef long long int Talx2llong atalx2;
|
||||
typedef unsigned long long int Talx2ullong atalx2;
|
||||
typedef float Talx2float atalx2;
|
||||
typedef double Talx2double atalx2;
|
||||
typedef long double Talx2ldouble atalx2;
|
||||
typedef _Complex float Talx2cfloat atalx2;
|
||||
typedef _Complex double Talx2cdouble atalx2;
|
||||
typedef _Complex long double Talx2cldouble atalx2;
|
||||
typedef enum E0 Talx2E0 atalx2;
|
||||
typedef enum E1 Talx2E1 atalx2;
|
||||
typedef enum E2 Talx2E2 atalx2;
|
||||
typedef enum E3 Talx2E3 atalx2;
|
||||
typedef enum E4 Talx2E4 atalx2;
|
||||
typedef enum E5 Talx2E5 atalx2;
|
||||
typedef enum E6 Talx2E6 atalx2;
|
||||
typedef enum E7 Talx2E7 atalx2;
|
||||
typedef enum E8 Talx2E8 atalx2;
|
||||
typedef enum E9 Talx2E9 atalx2;
|
||||
typedef void *Talx2ptr atalx2;
|
||||
typedef char *Talx2cptr atalx2;
|
||||
typedef int *Talx2iptr atalx2;
|
||||
typedef int Talx4int atalx4;
|
||||
typedef unsigned int Talx4uint atalx4;
|
||||
typedef long int Talx4long atalx4;
|
||||
typedef unsigned long int Talx4ulong atalx4;
|
||||
typedef long long int Talx4llong atalx4;
|
||||
typedef unsigned long long int Talx4ullong atalx4;
|
||||
typedef float Talx4float atalx4;
|
||||
typedef double Talx4double atalx4;
|
||||
typedef long double Talx4ldouble atalx4;
|
||||
typedef _Complex float Talx4cfloat atalx4;
|
||||
typedef _Complex double Talx4cdouble atalx4;
|
||||
typedef _Complex long double Talx4cldouble atalx4;
|
||||
typedef enum E0 Talx4E0 atalx4;
|
||||
typedef enum E1 Talx4E1 atalx4;
|
||||
typedef enum E2 Talx4E2 atalx4;
|
||||
typedef enum E3 Talx4E3 atalx4;
|
||||
typedef enum E4 Talx4E4 atalx4;
|
||||
typedef enum E5 Talx4E5 atalx4;
|
||||
typedef enum E6 Talx4E6 atalx4;
|
||||
typedef enum E7 Talx4E7 atalx4;
|
||||
typedef enum E8 Talx4E8 atalx4;
|
||||
typedef enum E9 Talx4E9 atalx4;
|
||||
typedef void *Talx4ptr atalx4;
|
||||
typedef char *Talx4cptr atalx4;
|
||||
typedef int *Talx4iptr atalx4;
|
||||
typedef long int Taly8long ataly8;
|
||||
typedef unsigned long int Taly8ulong ataly8;
|
||||
typedef long long int Talx8llong atalx8;
|
||||
typedef unsigned long long int Talx8ullong atalx8;
|
||||
typedef double Talx8double atalx8;
|
||||
typedef long double Talx8ldouble atalx8;
|
||||
typedef _Complex float Talx8cfloat atalx8;
|
||||
typedef _Complex double Talx8cdouble atalx8;
|
||||
typedef _Complex long double Talx8cldouble atalx8;
|
||||
typedef void *Taly8ptr ataly8;
|
||||
typedef char *Taly8cptr ataly8;
|
||||
typedef int *Taly8iptr ataly8;
|
||||
typedef _Complex double Talx16cdouble atalx16;
|
||||
typedef _Complex long double Talx16cldouble atalx16;
|
||||
typedef int (*Tfnptr) (void);
|
||||
|
||||
#define T(n, fields, ops) TX(n, struct, , fields, ({ ops });)
|
||||
#define U(n, fields, ops) TX(n, union, , fields, ({ ops });)
|
1450
gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c
Normal file
1450
gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c
Normal file
File diff suppressed because it is too large
Load Diff
68
gcc/testsuite/g++.dg/compat/struct-layout-1_x1.h
Normal file
68
gcc/testsuite/g++.dg/compat/struct-layout-1_x1.h
Normal file
@ -0,0 +1,68 @@
|
||||
#include "struct-layout-1.h"
|
||||
|
||||
struct Info info;
|
||||
int fails;
|
||||
int intarray[256];
|
||||
int fn0 (void) { return 0; }
|
||||
int fn1 (void) { return 1; }
|
||||
int fn2 (void) { return 2; }
|
||||
int fn3 (void) { return 3; }
|
||||
int fn4 (void) { return 4; }
|
||||
int fn5 (void) { return 5; }
|
||||
int fn6 (void) { return 6; }
|
||||
int fn7 (void) { return 7; }
|
||||
int fn8 (void) { return 8; }
|
||||
int fn9 (void) { return 9; }
|
||||
|
||||
/* This macro is intended for fields where their
|
||||
addresses/sizes/alignments and value passing should be checked. */
|
||||
#define F(n, x, v, w) \
|
||||
info.flds[i] = &s##n.x; \
|
||||
info.sizes[i] = sizeof (s##n.x); \
|
||||
info.aligns[i] = __alignof__ (s##n.x); \
|
||||
s##n.x = v; \
|
||||
a##n[2].x = w; \
|
||||
++i;
|
||||
/* This macro is for fields where just their addresses/sizes/alignments
|
||||
should be checked. */
|
||||
#define N(n, x) \
|
||||
info.flds[i] = &s##n.x; \
|
||||
info.sizes[i] = sizeof (s##n.x); \
|
||||
info.aligns[i] = __alignof__ (s##n.x); \
|
||||
++i;
|
||||
/* This macro is for fields where just value passing should be checked. */
|
||||
#define B(n, x, v, w) \
|
||||
s##n.x = v; \
|
||||
a##n[2].x = w; \
|
||||
++j;
|
||||
#define TX(n, type, attrs, fields, ops) \
|
||||
type S##n { fields } attrs; \
|
||||
type S##n s##n; \
|
||||
extern type S##n a##n[5]; \
|
||||
extern type S##n check##n (type S##n, type S##n *, \
|
||||
type S##n); \
|
||||
extern void check##n##va (int i, ...); \
|
||||
extern void checkx##n (type S##n); \
|
||||
void test##n (void) \
|
||||
{ \
|
||||
int i, j; \
|
||||
memset (&s##n, '\0', sizeof (s##n)); \
|
||||
memset (a##n, '\0', sizeof (a##n)); \
|
||||
memset (&info, '\0', sizeof (info)); \
|
||||
info.sp = &s##n; \
|
||||
info.a0p = &a##n[0]; \
|
||||
info.a3p = &a##n[3]; \
|
||||
info.sz = sizeof (s##n); \
|
||||
info.als = __alignof__ (s##n); \
|
||||
info.ala0 = __alignof__ (a##n[0]); \
|
||||
info.ala3 = __alignof__ (a##n[3]); \
|
||||
if (((long) &a##n[3]) & (info.als - 1)) \
|
||||
FAIL (n, 1); \
|
||||
i = 0; j = 0; \
|
||||
ops \
|
||||
info.nfields = i; \
|
||||
info.nbitfields = j; \
|
||||
checkx##n (check##n (s##n, &a##n[1], a##n[2])); \
|
||||
check##n##va (1, 1.0, s##n, 2LL, a##n[2], a##n[2]); \
|
||||
check##n##va (2, s##n, s##n, 2.0L, a##n[2], s##n); \
|
||||
}
|
14
gcc/testsuite/g++.dg/compat/struct-layout-1_x2.h
Normal file
14
gcc/testsuite/g++.dg/compat/struct-layout-1_x2.h
Normal file
@ -0,0 +1,14 @@
|
||||
#undef F
|
||||
#undef N
|
||||
#undef B
|
||||
#undef TX
|
||||
#define F(n, x, v, w) \
|
||||
if (arg.x != s##n.x) FAIL (n, 30);
|
||||
#define N(n, x)
|
||||
#define B(n, x, v, w) \
|
||||
if (arg.x != s##n.x) FAIL (n, 30);
|
||||
#define TX(n, type, attrs, fields, ops) \
|
||||
void checkx##n (type S##n arg) \
|
||||
{ \
|
||||
ops \
|
||||
}
|
76
gcc/testsuite/g++.dg/compat/struct-layout-1_y1.h
Normal file
76
gcc/testsuite/g++.dg/compat/struct-layout-1_y1.h
Normal file
@ -0,0 +1,76 @@
|
||||
#include "struct-layout-1.h"
|
||||
|
||||
#define F(n, x, v, w) \
|
||||
if (info.flds[i] != &s##n.x) \
|
||||
FAIL (n, 50); \
|
||||
if (info.sizes[i] != sizeof (s##n.x)) \
|
||||
FAIL (n, 51); \
|
||||
if (info.aligns[i] != __alignof__ (s##n.x)) \
|
||||
FAIL (n, 52); \
|
||||
if (s##n.x != (__typeof__ (s##n.x)) v) \
|
||||
FAIL (n, 53); \
|
||||
if (a##n[2].x != (__typeof__ (s##n.x)) w) \
|
||||
FAIL (n, 54); \
|
||||
if (arg0.x != s##n.x) \
|
||||
FAIL (n, 55); \
|
||||
if (arg2.x != a##n[2].x) \
|
||||
FAIL (n, 56); \
|
||||
ret.x = s##n.x; \
|
||||
++i;
|
||||
#define N(n, x) \
|
||||
if (info.flds[i] != &s##n.x) \
|
||||
FAIL (n, 50); \
|
||||
if (info.sizes[i] != sizeof (s##n.x)) \
|
||||
FAIL (n, 51); \
|
||||
if (info.aligns[i] != __alignof__ (s##n.x)) \
|
||||
FAIL (n, 52); \
|
||||
++i;
|
||||
#define B(n, x, v, w) \
|
||||
b1.x = v; b2.x = w; \
|
||||
if (s##n.x != b1.x) \
|
||||
FAIL (n, 53); \
|
||||
if (a##n[2].x != b2.x) \
|
||||
FAIL (n, 54); \
|
||||
if (arg0.x != s##n.x) \
|
||||
FAIL (n, 55); \
|
||||
if (arg2.x != a##n[2].x) \
|
||||
FAIL (n, 56); \
|
||||
ret.x = s##n.x; \
|
||||
++j;
|
||||
#define TX(n, type, attrs, fields, ops) \
|
||||
type S##n { fields } attrs; \
|
||||
extern type S##n s##n; \
|
||||
type S##n a##n[5]; \
|
||||
type S##n \
|
||||
check##n (type S##n arg0, type S##n *arg1, type S##n arg2) \
|
||||
{ \
|
||||
type S##n ret; \
|
||||
type S##n b1, b2; \
|
||||
int i, j; \
|
||||
\
|
||||
memset (&ret, 0, sizeof (ret)); \
|
||||
memset (&b1, 0, sizeof (b1)); \
|
||||
memset (&b2, 0, sizeof (b2)); \
|
||||
if (info.sp != &s##n) \
|
||||
FAIL (n, 10); \
|
||||
if (info.a0p != &a##n[0]) \
|
||||
FAIL (n, 11); \
|
||||
if (info.a3p != &a##n[3]) \
|
||||
FAIL (n, 12); \
|
||||
if (info.sz != sizeof (s##n)) \
|
||||
FAIL (n, 13); \
|
||||
if (info.als != __alignof__ (s##n)) \
|
||||
FAIL (n, 14); \
|
||||
if (info.ala0 != __alignof__ (a##n[0])) \
|
||||
FAIL (n, 15); \
|
||||
if (info.ala3 != __alignof__ (a##n[3])) \
|
||||
FAIL (n, 16); \
|
||||
if (arg1 != &a##n[1]) \
|
||||
FAIL (n, 17); \
|
||||
i = 0; j = 0; \
|
||||
ops \
|
||||
if (i != info.nfields || j != info.nbitfields) \
|
||||
FAIL (n, 18); \
|
||||
\
|
||||
return ret; \
|
||||
}
|
69
gcc/testsuite/g++.dg/compat/struct-layout-1_y2.h
Normal file
69
gcc/testsuite/g++.dg/compat/struct-layout-1_y2.h
Normal file
@ -0,0 +1,69 @@
|
||||
#undef F
|
||||
#undef N
|
||||
#undef B
|
||||
#undef TX
|
||||
|
||||
#ifdef SKIP_VA
|
||||
const int test_va = 0;
|
||||
#else
|
||||
const int test_va = 1;
|
||||
#endif
|
||||
|
||||
#define F(n, x, v, w) \
|
||||
if (p->x != arg.x) FAIL (n, 74);
|
||||
#define N(n, x)
|
||||
#define B(n, x, v, w) \
|
||||
if (p->x != arg.x) FAIL (n, 74);
|
||||
#define TX(n, type, attrs, fields, ops) \
|
||||
void \
|
||||
check##n##va (int z, ...) \
|
||||
{ \
|
||||
type S##n arg, *p; \
|
||||
va_list ap; \
|
||||
int i; \
|
||||
\
|
||||
if (test_va) \
|
||||
{ \
|
||||
va_start (ap, z); \
|
||||
for (i = 0; i < 5; ++i) \
|
||||
{ \
|
||||
p = NULL; \
|
||||
switch ((z << 4) | i) \
|
||||
{ \
|
||||
case 0x10: \
|
||||
if (va_arg (ap, double) != 1.0) \
|
||||
FAIL (n, 70); \
|
||||
break; \
|
||||
case 0x12: \
|
||||
if (va_arg (ap, long long) != 2LL) \
|
||||
FAIL (n, 71); \
|
||||
break; \
|
||||
case 0x22: \
|
||||
if (va_arg (ap, long double) != 2.0L) \
|
||||
FAIL (n, 72); \
|
||||
break; \
|
||||
case 0x11: \
|
||||
case 0x20: \
|
||||
case 0x21: \
|
||||
case 0x24: \
|
||||
p = &s##n; \
|
||||
arg = va_arg (ap, type S##n); \
|
||||
break; \
|
||||
case 0x13: \
|
||||
case 0x14: \
|
||||
case 0x23: \
|
||||
p = &a##n[2]; \
|
||||
arg = va_arg (ap, type S##n); \
|
||||
break; \
|
||||
default: \
|
||||
FAIL (n, 73); \
|
||||
break; \
|
||||
} \
|
||||
if (p) \
|
||||
{ \
|
||||
ops \
|
||||
} \
|
||||
} \
|
||||
va_end (ap); \
|
||||
} \
|
||||
}
|
Loading…
Reference in New Issue
Block a user