ref: 275a2ef9b9df16b5b5d7811fe0748bf0a3842743
parent: 4b2e771b524ffb7e9b903a416eb8cb1e995b9449
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Sep 25 13:09:31 EDT 2015
Move limits again to cc1/types.c Nothing in this array depends of the architecture, because it only keeps the limits for every signess and size.
--- a/cc1/arch/z80/types.c
+++ b/cc1/arch/z80/types.c
@@ -37,67 +37,6 @@
#define L_LDOUBLE 'H'
/*
- * Compiler can generate warnings here if the ranges of TINT,
- * TUINT and TFLOAT are smaller than any of the constants in this
- * array. Ignore them if you know that the target types are correct
- */
-struct limits limits[][4] = {
- {
- { /* 0 = unsigned 1 byte */
- .min.u = 0,
- .max.u = 255
- },
- { /* 1 = unsigned 2 bytes */
- .min.u = 0,
- .max.u = 65535u
- },
- { /* 2 = unsigned 4 bytes */
- .min.u = 0,
- .max.u = 4294967295u
- },
- { /* 3 = unsigned 4 bytes */
- .min.u = 0,
- .max.u = 18446744073709551615u
- }
- },
- {
- { /* 0 = signed 1 byte */
- .min.i = -127,
- .max.i = 127
- },
- { /* 1 = signed 2 byte */
- .min.i = -32767,
- .max.i = 32767
- },
- { /* 2 = signed 4 byte */
- .min.i = -2147483647L,
- .max.i = 2147483647L
- },
- { /* 3 = signed 8 byte */
- .min.i = -9223372036854775807LL,
- .max.i = 9223372036854775807LL,
- }
- },
- {
- {
- /* 0 = float 4 bytes */
- .min.f = -1,
- .max.f = 2
- },
- {
- /* 1 = float 8 bytes */
- .min.f = -1,
- .max.f = 2,
- },
- {
- /* 2 = float 16 bytes */
- .min.f = -1,
- .max.f = 2,
- }
- }
-};
-
-/*
* Initializaion of type pointers were done with
* a C99 initilizator '... = &(Type) {...', but
* c compiler in Plan9 gives error with this
--- a/cc1/types.c
+++ b/cc1/types.c
@@ -11,7 +11,66 @@
#define NR_TYPE_HASH 16
-extern struct limits limits[][4];
+/*
+ * Compiler can generate warnings here if the ranges of TINT,
+ * TUINT and TFLOAT are smaller than any of the constants in this
+ * array. Ignore them if you know that the target types are correct
+ */
+struct limits limits[][4] = {
+ {
+ { /* 0 = unsigned 1 byte */
+ .min.u = 0,
+ .max.u = 255
+ },
+ { /* 1 = unsigned 2 bytes */
+ .min.u = 0,
+ .max.u = 65535u
+ },
+ { /* 2 = unsigned 4 bytes */
+ .min.u = 0,
+ .max.u = 4294967295u
+ },
+ { /* 3 = unsigned 4 bytes */
+ .min.u = 0,
+ .max.u = 18446744073709551615u
+ }
+ },
+ {
+ { /* 0 = signed 1 byte */
+ .min.i = -127,
+ .max.i = 127
+ },
+ { /* 1 = signed 2 byte */
+ .min.i = -32767,
+ .max.i = 32767
+ },
+ { /* 2 = signed 4 byte */
+ .min.i = -2147483647L,
+ .max.i = 2147483647L
+ },
+ { /* 3 = signed 8 byte */
+ .min.i = -9223372036854775807LL,
+ .max.i = 9223372036854775807LL,
+ }
+ },
+ {
+ {
+ /* 0 = float 4 bytes */
+ .min.f = -1,
+ .max.f = 2
+ },
+ {
+ /* 1 = float 8 bytes */
+ .min.f = -1,
+ .max.f = 2,
+ },
+ {
+ /* 2 = float 16 bytes */
+ .min.f = -1,
+ .max.f = 2,
+ }
+ }
+};
struct limits *
getlimits(Type *tp)