Commit graph

23 commits

Author SHA1 Message Date
George Koehler 007a63d529 Begin to add long long to C compiler for linux386.
Add long long type, but without literals; you can't say '123LL' yet.
You can try constant operations, like `(long long)123 + 1`, but the
compiler's `arith` type might not be wide enough.  Conversions,
shifts, and some other operations don't work in i386 ncg; I am using a
union instead of conversions:

	union q {
		long long ll;
		unsigned long long ull;
		int i[2];
	};

Hack plat/linux386/descr to enable long long (size 8, alignment 4)
only for this platform.  The default for other platforms is to disable
long long (size -1).

In lang/cem/cemcom.ansi,

 - BigPars, SmallPars: Add default size, alignment of long long.
 - align.h: Add lnglng_align.
 - arith.c: Convert arithmetic operands to long long or unsigned long
   long when necessary; avoid conversion from long long to long.
   Allow long long as an arithmetic, integral, or logical operand.
 - ch3.c: Handle long long like int and long when erroneously applying
   a selector, like `long long ll; ll.member` or `ll->member`.  Add
   long long to integral and arithmetic types.
 - code.c: Add long long to type stabs for debugging.
 - conversion.c: Add long long to integral conversions.
 - cstoper.c: Write masks up to full_mask[8].  Add FIXME comment.
 - declar.g: Parse `long long` in code.
 - decspecs.c: Understand long long in type declarations.
 - eval.c: Add long long to operations, to generate code like `adi 8`.
   Don't use `ldc` with constant over 4 bytes.
 - ival.g: Allow long long in initializations.
 - main.c: Set lnglng_type and related values.
 - options.c: Add option like `-Vq8.4` to set long long to size 8,
   alignment 4.  I chose 'q', because Perl's pack and Ruby's
   Array#pack use 'q' for 64-bit or long long values; it might be a
   reference to BSD's old quad_t alias for long long.
 - sizes.h: Add lnglng_size.
 - stab.c: Allow long long when writing the type stab for debugging.
   Switch from calculating the ranges to hardcoding them in strings;
   add 8-byte ranges as a special case.  This also hardcodes the
   unsigned 4-byte range as "0;-1".  Before it was either "0;-1" or
   "0;4294967295", depending on sizeof(long) in the compiler.
 - struct.c: Try long long bitfield, but it will probably give the
   error, "bit field type long long does not fit in a word".
 - switch.c: Update comment.
 - tokenname.c: Define LNGLNG (long long) like LNGDBL (long double).
 - type.c, type.str: Add lnglng_type and ulnglng_type.  Add function
   no_long_long() to check if long long is disabled.
2019-09-02 11:24:44 -04:00
carl f74b29d303 * Remove some more compiler warnings. 2019-02-24 00:46:05 +08:00
carl 750a6bc684 Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
+ Scripts to generate compiler header is now sed based.
2019-02-19 00:54:23 +08:00
David Given cb983fac44 Rip out the built-in preprocessor from cemcom.ansi, now it's no longer used. 2018-09-02 12:50:50 +02:00
David Given c18a82ec40 Apply build system fixes for OpenBSD contributed by George Koehler. 2013-05-18 12:15:53 +01:00
David Given c1aca7dae5 First milestone of replacing the build system.
--HG--
branch : dtrg-buildsystem
rename : lang/cem/cpp.ansi/Parameters => lang/cem/cpp.ansi/parameters.h
2013-05-12 20:45:55 +01:00
dtrg e859ef2491 Rationalised use of #includes to be more standards-compliant. 2006-07-19 10:28:43 +00:00
ceriel 8636e9d10a Changed Header into Id 1994-06-27 08:03:14 +00:00
ceriel 439ec389a0 found some small leaks with Purify 1993-01-18 15:10:01 +00:00
ceriel a38be6605e Do not use '#endif/#else xxx'; it is not allowed for ANSI C 1991-12-17 13:12:22 +00:00
ceriel 9f43986877 ANSI requires separate name space for labels, and made to use idf module 1991-06-19 16:12:56 +00:00
ceriel 30867cf631 the -S option also falls under ifndef NOCROSS 1991-03-07 12:51:11 +00:00
ceriel bd1da2f86c Improved switches, and fixed wrong place indication in error messages 1991-03-01 13:51:37 +00:00
ceriel c747f1c1c0 simplified options.c 1990-12-19 11:07:15 +00:00
ceriel 41e3cf403b Added support for debugger, de-linted somewhat 1990-10-01 15:28:28 +00:00
eck 7dff46d44e fixed bug with -I flag 1990-09-27 15:59:38 +00:00
eck 7f5abdd670 fixed int to unsigned conversions, declarations, pp-list initialization 1990-07-13 10:18:27 +00:00
ceriel f234f061a1 Added dependency generator, reduced size of type structure 1990-06-08 10:03:47 +00:00
eck 64e9d11570 the -U option did not work properly; call do_undef() now 1990-04-18 16:40:17 +00:00
eck 52f08181a6 two -D options for one identifier didn't work 1990-04-18 13:09:36 +00:00
eck 480de7cafb fixed some bugs, changed warning interface 1989-10-27 13:33:10 +00:00
eck fa4e6eecb4 lots and lots of changes & improvements 1989-09-19 16:13:23 +00:00
ceriel 926da49d39 Initial revision 1989-02-07 11:04:05 +00:00