Commit Graph

10131 Commits

Author SHA1 Message Date
Bill Currie 526c27cf03 Handle implicit casts for double/float comparisons 2020-02-23 23:10:10 +09:00
Bill Currie 607fd2e30e Allow constant initialized globals in advanced code
Use -C const-initializers to enable (or no-const-initializers to disable
in traditional/extended code).
2020-02-23 22:51:00 +09:00
Bill Currie e23aa40994 Implicitly cast unadorned floating point constants
Floating point constants without f or d adornments will automatically
cast, without warnings, to the type appropriate to the rest of the
expression.
2020-02-23 22:28:54 +09:00
Bill Currie 14cde99d6e White space
of the worst sort.
2020-02-23 22:27:07 +09:00
Bill Currie e6f243323e Fix type of class in qfo type encodings 2020-02-23 22:26:09 +09:00
Bill Currie 23573953a7 Change pr_type_size to pr_ushort_t 2020-02-23 22:25:08 +09:00
Bill Currie 7efefceee2 Fix a comment 2020-02-23 22:21:25 +09:00
Bill Currie ea3af84baa Fix ICE when const-folding doubles
I really need to rework that system.
2020-02-23 20:49:56 +09:00
Bill Currie 2a39208069 Set void alignment to 1
qcc allowed void variables.
2020-02-23 20:48:43 +09:00
Bill Currie c9fca9c98a Fix another inside-out type utility function 2020-02-23 20:48:12 +09:00
Bill Currie c3c55f0bcc Fix some source formatting 2020-02-23 19:05:43 +09:00
Bill Currie d0dc0e15fb Handle alias types in debug prints 2020-02-23 19:02:16 +09:00
Bill Currie b173c35eb4 Rework progs debug to use the type encodings
It's only a start: the output is, if anything, slightly worse than
before, but it does have the basics going.
2020-02-23 19:01:59 +09:00
Bill Currie 4b7ecdf74a Make PR_Init take an instance to initialize
This allows internal sub-systems to do per-instance initializations
without other engine systems having to know about them.
2020-02-23 18:32:16 +09:00
Bill Currie 6009d1d023 Fix qfo strings dumping 2020-02-23 15:08:31 +09:00
Bill Currie b0157e5095 Fix qfo field dumping 2020-02-23 14:56:50 +09:00
Bill Currie 81293d98dd Fix qfo line info dumping
The addition of xdef data has made qfo_to_progs unusable in qfprogs,
resulting in various invalid memory accesses. It always was an ugly hack
anyway, so this is the first step to proper qfo support in qfprogs.
2020-02-23 14:44:25 +09:00
Bill Currie 155a633ebe Include extended defs data in the size report 2020-02-23 11:53:57 +09:00
Bill Currie 6c6433dea5 Fetch the def name only once when scanning
Not that speed is critical at this point, but it feels better.
2020-02-23 11:52:35 +09:00
Bill Currie f8b1a3a89f Return the previous sys print callbacks
This allows for temporary overrides.
2020-02-23 11:41:19 +09:00
Bill Currie 52d54f98bf Fix some issues in the typedef test
It wasn't being strict enough in the test (but was good enough to catch
the relocation error, at least) and was printing the alias name
incorrectly.
2020-02-22 23:41:09 +09:00
Bill Currie 3aabfa71d9 Find lost type encoding relocations
I have no idea why I thought it was a good idea to delete those lines.
Yay for regression tests, though.
2020-02-22 23:33:56 +09:00
Bill Currie 806af85447 Remove reference to ddef_t from progs.h
This cleans up some horrible names and redundant fields that were a
result of the transition to pr_def_t
2020-02-22 22:44:08 +09:00
Bill Currie 81083698a8 Move to using an in-memory form of ddef_t
This allows the VM to work with extended ddefs transparently. It seems
to have uncovered a typedef alias relocation bug, though.
2020-02-22 22:33:44 +09:00
Bill Currie 4df926e531 Write extended ddef information to progs far data
I was originally going to put it in the debug syms file, but I realized
that the data persistence code would need access to both def type and
certainly correct def offsets for defs in far data.
2020-02-22 14:11:15 +09:00
Bill Currie e7b4eedc07 Fix segfault in dereferencing undefined field containers 2020-02-22 14:04:10 +09:00
Bill Currie c296514b95 Make pr.load_file 'return' the file size 2020-02-21 21:17:28 +09:00
Bill Currie 7e76a96f7d Fix a missed ty_none 2020-02-21 21:13:18 +09:00
Bill Currie fe796eee68 Move the meta type enum ino pr_type.h 2020-02-21 17:58:19 +09:00
Bill Currie 3c9e2a6451 Rename the sys documentation group 2020-02-21 17:54:42 +09:00
Bill Currie 8b225dbfc1 Ensure .ctor functions do not reset tracing 2020-02-21 17:53:27 +09:00
Bill Currie caf78b5422 Rename ty_none to ty_basic
This far better reflects the actual meaning. It is very likely that
ty_none is a holdover from long before there was full type encoding and
it meant that the union in qfcc's type_t had no data. This is still
true for basic types, but only if not a function, field or pointer type.
If the type was function, field or pointer, it was not true, so it was
misnamed pretty much from the start.
2020-02-21 17:52:00 +09:00
Bill Currie 1b43046c8a Handle aliased types when building function calls 2020-02-19 21:41:46 +09:00
Bill Currie fd2b7ee6f9 Use more type checking helper functions 2020-02-19 21:41:46 +09:00
Bill Currie a6003ed08a Walk qfo alias chain for type size and alignment
While the basic type is stored in the alias type record, it's no good
for size or alignment as it will give incorrect results for complex
types.
2020-02-19 21:41:46 +09:00
Bill Currie a0914e1ec8 Fix the typedef test case to actually work 2020-02-19 21:41:46 +09:00
Bill Currie 6a70d2e362 Give alias types a unique encoding
The encoding is used as the def name and it needs to be different than
the alias target or the linker throws it away as an external def.
2020-02-19 21:41:46 +09:00
Bill Currie 6bc803c72d Use correct encoding for alias types
I got confused which field was which.
2020-02-19 21:41:46 +09:00
Bill Currie 6bcc2c49ab Use helper functions for type checks
They hide the evil details of aliased types. More to come :/
2020-02-19 21:41:46 +09:00
Bill Currie 9610788dea Fix some more type aliasing issues
Getting there... (I knew this would be a big job)
2020-02-19 21:41:46 +09:00
Bill Currie d50a27a045 Race down the alias chain before checking types
This takes care of some of the type aliasing issues.
2020-02-19 21:41:46 +09:00
Bill Currie a5aba6c8ac Implement type aliasing
The separate types are in the file, but there are multiple issues
2020-02-19 21:41:46 +09:00
Bill Currie 2f18364364 Start work on encoding typedef chains 2020-02-19 21:41:46 +09:00
Bill Currie adb7f5d601 Quieten the test script build rules 2020-02-19 21:41:46 +09:00
Bill Currie 2db5d04e3f Reduce the ephemeral nature of str_mid
When the substring is the tail of the supplied string, return a
"pointer" to within the supplied string rather than a new "return"
string. This means that tail-end substrings of string constants are
themselves constants.
2020-02-19 21:41:46 +09:00
Bill Currie b00c866c4e Allow casting between string and pointer types 2020-02-19 21:41:46 +09:00
Bill Currie a6f3e1753a Fix ruamoko's hashtab_t typedef
Being typedefed directly to a pointer is a holdover from when pointer
declarations were really awkward.
2020-02-19 21:41:46 +09:00
Bill Currie 7a315b4a89 Fix storage class for for-loop declarations
Getting "i redeclared" when i was declared in a for loop in two
different functions was a tad unexpected.
2020-02-19 21:41:46 +09:00
Bill Currie 67e183c8b6 Put the guts of qwaq's reflection code into ruamoko 2020-02-19 21:41:46 +09:00
Bill Currie 4c40928112 Remove what appears to be a redundant check
It was long wrong anyway as it checked past the end of the function's
parameters, which caused a segfault when calling varargs functions with
no formal parameters.
2020-02-19 02:53:38 +09:00