aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-10-29 20:31:49 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-10-30 09:52:35 +0100
commitfba1931d2c2779b0b84e4837c51187d9d2fe0226 (patch)
tree30e2df00b5e6076c2ce81993a7c31acec4b26e70
parent92907fce1391eff64246b7ac51a40ded6df58640 (diff)
downloadsparse-fba1931d2c2779b0b84e4837c51187d9d2fe0226.tar.gz
cgcc: removed unneeded predefines for integers
Now that the arch is passed to sparse via '--arch=ARCH', all predefines for integers and pointers are defined in sparse itself. So, integer_types() & define_size_t() are now unneeded. Remove these functions and -D__SIZEOF_POINTER__. Note: sparc64 had also an entry for 128-bit integers (with name 'LONG_LONG_LONG' and suffix 'LLL'); GCC only predefines the SIZEOF macros which sparse also does (but for all archs). So, it's fine to remove these also. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rwxr-xr-xcgcc52
1 files changed, 4 insertions, 48 deletions
diff --git a/cgcc b/cgcc
index 0ac9a55c..8e8c510e 100755
--- a/cgcc
+++ b/cgcc
@@ -148,30 +148,6 @@ sub quote_arg {
# -----------------------------------------------------------------------------
-sub integer_types {
- my ($char,@dummy) = @_;
-
- my %pow2m1 =
- (8 => '127',
- 16 => '32767',
- 32 => '2147483647',
- 64 => '9223372036854775807',
- 128 => '170141183460469231731687303715884105727',
- );
- my @types = (['SCHAR',''], ['SHRT',''], ['INT',''], ['LONG','L'], ['LONG_LONG','LL'], ['LONG_LONG_LONG','LLL']);
-
- my $result = " -D__CHAR_BIT__=$char";
- while (@types && @_) {
- my $bits = shift @_;
- my ($name,$suffix) = @{ shift @types };
- die "$0: weird number of bits." unless exists $pow2m1{$bits};
- $result .= " -D__${name}_MAX__=" . $pow2m1{$bits} . $suffix;
- }
- return $result;
-}
-
-# -----------------------------------------------------------------------------
-
sub float_types {
my ($has_inf,$has_qnan,$dec_dig,@bitsizes) = @_;
my $result = " -D__FLT_RADIX__=2";
@@ -241,14 +217,6 @@ sub float_types {
# -----------------------------------------------------------------------------
-sub define_size_t {
- my ($text) = @_;
- # We have to undef in order to override check's internal definition.
- return ' -U__SIZE_TYPE__ ' . &quote_arg ("-D__SIZE_TYPE__=$text");
-}
-
-# -----------------------------------------------------------------------------
-
sub add_specs {
my ($spec) = @_;
if ($spec eq 'sunos') {
@@ -299,27 +267,18 @@ sub add_specs {
} elsif ($spec eq 'sparc') {
return (
' --arch=sparc' .
- &integer_types (8, 16, 32, $m64 ? 64 : 32, 64) .
- &float_types (1, 1, 33, [24,8], [53,11], [113,15]) .
- &define_size_t ($m64 ? "long unsigned int" : "unsigned int") .
- ' -D__SIZEOF_POINTER__=' . ($m64 ? '8' : '4'));
+ &float_types (1, 1, 33, [24,8], [53,11], [113,15]));
} elsif ($spec eq 'sparc64') {
return (
' --arch=sparc64' .
- &integer_types (8, 16, 32, 64, 64, 128) .
- &float_types (1, 1, 33, [24,8], [53,11], [113,15]) .
- &define_size_t ("long unsigned int") .
- ' -D__SIZEOF_POINTER__=8');
+ &float_types (1, 1, 33, [24,8], [53,11], [113,15]));
} elsif ($spec eq 'x86_64') {
return (' --arch=x86_64' .
&float_types (1, 1, 33, [24,8], [53,11], [113,15]));
} elsif ($spec eq 'ppc') {
return (' -D_BIG_ENDIAN -D_STRING_ARCH_unaligned=1' .
' --arch=ppc' .
- &integer_types (8, 16, 32, $m64 ? 64 : 32, 64) .
- &float_types (1, 1, 21, [24,8], [53,11], [113,15]) .
- &define_size_t ($m64 ? "long unsigned int" : "unsigned int") .
- ' -D__SIZEOF_POINTER__=' . ($m64 ? '8' : '4'));
+ &float_types (1, 1, 21, [24,8], [53,11], [113,15]));
} elsif ($spec eq 'ppc64') {
return (' -D_STRING_ARCH_unaligned=1 ' .
' --arch=ppc64' .
@@ -331,10 +290,7 @@ sub add_specs {
} elsif ($spec eq 's390x') {
return (' -D_BIG_ENDIAN' .
' --arch=s390x' .
- &integer_types (8, 16, 32, $m64 ? 64 : 32, 64) .
- &float_types (1, 1, 36, [24,8], [53,11], [113,15]) .
- &define_size_t ("long unsigned int") .
- ' -D__SIZEOF_POINTER__=' . ($m64 ? '8' : '4'));
+ &float_types (1, 1, 36, [24,8], [53,11], [113,15]));
} elsif ($spec eq 'arm') {
return (' --arch=arm' .
&float_types (1, 1, 36, [24,8], [53,11], [53, 11]));