X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fq2c.c;h=20b245986b127b3bc8ddd703048d11def95f7682;hb=ca1feaeed4961242699d0b7ba61def0c58515ddd;hp=197fd8d9ca00a843f9b9dee7306496c9c58832a2;hpb=3a7fba81ceae5b049d0f7d671e9e3c3c43bbf703;p=pspp-builds.git diff --git a/src/q2c.c b/src/q2c.c index 197fd8d9..20b24598 100644 --- a/src/q2c.c +++ b/src/q2c.c @@ -99,9 +99,7 @@ finish_up (void) fprintf (stderr, "%s: %s: remove: %s\n", pgmname, ofn, strerror (errno)); } -#if __GNUC__ >= 2 -void hcf (void) __attribute__ ((noreturn)); -#endif +void hcf (void) NO_RETURN; /* Terminate unsuccessfully. */ void @@ -111,10 +109,8 @@ hcf (void) exit (EXIT_FAILURE); } -#if __GNUC__ >= 2 -int fail (const char *, ...) __attribute__ ((format (printf, 1, 2))); -int error (const char *, ...) __attribute__ ((format (printf, 1, 2))); -#endif +int fail (const char *, ...) PRINTF_FORMAT (1, 2); +int error (const char *, ...) PRINTF_FORMAT (1, 2); /* Output an error message and terminate unsuccessfully. */ int @@ -859,9 +855,7 @@ parse_subcommands (void) /* Size of the indent from the left margin. */ int indent; -#if __GNUC__ >= 2 -void dump (int, const char *, ...) __attribute__ ((format (printf, 2, 3))); -#endif +void dump (int, const char *, ...) PRINTF_FORMAT (2, 3); /* Write line FORMAT to the output file, formatted as with printf, indented `indent' characters from the left margin. If INDENTION is @@ -1097,6 +1091,10 @@ dump_declarations (void) dump (0, "long n_%s;", st_lower (sbc->name)); break; + case SBC_DBL: + dump (0, "double n_%s;", st_lower (sbc->name)); + break; + default:; /* nothing */ } @@ -1537,11 +1535,19 @@ dump_subcommand (const subcommand *sbc) if (sbc->restriction) dump (-1, "}"); } + else if (sbc->type == SBC_DBL) + { + dump (1, "if (!lex_force_num ())"); + dump (0, "goto lossage;"); + dump (-1, "p->n_%s = lex_double ();", st_lower (sbc->name)); + dump (0, "lex_get();"); + } else if (sbc->type == SBC_INT) { dump (1, "if (!lex_force_int ())"); dump (0, "goto lossage;"); dump (-1, "p->n_%s = lex_integer ();", st_lower (sbc->name)); + dump (0, "lex_get();"); } else if (sbc->type == SBC_PINT) { @@ -1698,7 +1704,7 @@ dump_header (void) loctime = localtime (&curtime); timep = asctime (loctime); timep[strlen (timep) - 1] = 0; - dump (0, "/* %s", ofn); + dump (0, "/* %s\t\t-*- mode: c; buffer-read-only: t -*-", ofn); dump (0, nullstr); dump (0, " Generated by q2c from %s on %s.", ifn, timep); dump (0, " Do not modify!"); @@ -1722,7 +1728,7 @@ dump_free (void) dump (0, "static void"); dump (0, "free_%s (struct cmd_%s *p%s)", make_identifier (cmdname), - make_identifier (cmdname), used ? "" : " unused"); + make_identifier (cmdname), used ? "" : " UNUSED"); dump (1, "{"); for (sbc = subcommands; sbc; sbc = sbc->next)