| SHORT {
$$=newLink();
$$->class = SPECIFIER ;
- $$->select.s._short = 1 ;
+ $$->select.s._short = 1 ;
}
| INT {
$$=newLink();
| SIGNED {
$$=newLink();
$$->class = SPECIFIER ;
- $$->select.s._signed = 1 ;
+ $$->select.s._signed = 1;
}
| UNSIGNED {
$$=newLink();
| CONST {
$$=newLink();
$$->class = SPECIFIER ;
- //SPEC_SCLS($$) = S_CONSTANT ;
SPEC_CONST($$) = 1;
}
| VOLATILE {
int nostdlib:1; /* Don't use standard lib files */
int nostdinc:1; /* Don't use standard include files */
int verbose:1; /* Show what the compiler is doing */
+ int shortisint:1; /* treat short like int or char */
char *calleeSaves[128]; /* list of functions using callee save */
char *excludeRegs[32]; /* registers excluded from saving */
#define OPTION_NOSTDINC "-nostdinc"
#define OPTION_VERBOSE "-verbose"
#define OPTION_LESS_PEDANTIC "-lesspedantic"
+#define OPTION_SHORT_IS_CHAR "-short-is-char"
+#define OPTION_SHORT_IS_INT "-short-is-int"
static const char *_preCmd[] =
{
options.nostdlib = 0;
options.nostdinc = 0;
options.verbose = 0;
+ options.shortisint = 0;
options.stack10bit=0;
options.verbose = 1;
continue;
}
+
+ if (strcmp (&argv[i][1], OPTION_SHORT_IS_INT) == 0) {
+ options.shortisint=1;
+ continue;
+ }
+
+ if (strcmp (&argv[i][1], OPTION_SHORT_IS_CHAR) == 0) {
+ options.shortisint=0;
+ continue;
+ }
if (strcmp (argv[i] +1, OPTION_LESS_PEDANTIC) == 0)
{
werror (E_SIGNED_OR_UNSIGNED_INVALID, noun, name);
}
- if (!SPEC_NOUN(etype)) {
- // special case for just "signed" or "unsigned" or "long"
- if (etype->select.s._signed || SPEC_USIGN(etype) || SPEC_LONG(etype)) {
- SPEC_NOUN(etype)=V_INT;
- }
- // special case for just "short"
- if (etype->select.s._short) {
- SPEC_NOUN(etype)=V_CHAR; // or maybe V_INT
- }
+ // special case for "short"
+ if (etype->select.s._short) {
+ SPEC_NOUN(etype) = options.shortisint ? V_INT : V_CHAR;
}
- // if still no noun (e.g. "const a;" or "data b;") assume an int
+ /* if no noun e.g.
+ "const a;" or "data b;" or "signed s" or "long l"
+ assume an int */
if (!SPEC_NOUN(etype)) {
SPEC_NOUN(etype)=V_INT;
}
if (SPEC_what(dest)) {
werror(W_DUPLICATE_SPEC, "what");
}
- SPEC_what(dst)=SPEC_what(src);
+ SPEC_what(dst)|=SPEC_what(src);
}
#endif
// but there are more important thing right now
SPEC_LONG (dest) |= SPEC_LONG (src);
- dest->select.s._short=src->select.s._short;
+ dest->select.s._short|=src->select.s._short;
SPEC_USIGN (dest) |= SPEC_USIGN (src);
- dest->select.s._signed=src->select.s._signed;
+ dest->select.s._signed|=src->select.s._signed;
SPEC_STAT (dest) |= SPEC_STAT (src);
SPEC_EXTR (dest) |= SPEC_EXTR (src);
SPEC_ABSA (dest) |= SPEC_ABSA (src);