Commit graph

3680 commits

Author SHA1 Message Date
Bill Currie
035da472ec [qfcc] Offset alias tempop offsets
Alias tempop offsets are relative to the real tempop. This fixes alias
tempops never overlapping the real tempop.
2020-03-08 16:51:01 +09:00
Bill Currie
695b3ba0d0 [qfcc] Rearrange vecexpr.r for easier debugging
Putting the most likely function to have problems at the top reduces
break-point shenanigans.
2020-03-08 16:50:39 +09:00
Bill Currie
d9d321f65b [qfcc] Check for previous errors in vector exprs
Fixes a segfault when one of the expressions used to construct the
vector was the result of an error.
2020-03-08 15:40:07 +09:00
Bill Currie
b81d58c795 Revert "[qfcc] Correct a comment"
This reverts commit a2f203c840.

There is indeed a world of difference between "any" and "only", and it
helps if I read the rest of the docs AND the code :P.
2020-03-08 14:58:57 +09:00
Bill Currie
8696e76a25 [qfcc] Handle aliases when setting use and def
As expected, this does not fix the mangled pointer problem in
struct-init-param.r, but it does improve the ud-chains. There's still a
problem with .return, but it's handling in flow_analyze_statement is a
bit "special" :P.
2020-03-08 12:17:56 +09:00
Bill Currie
a2f203c840 [qfcc] Correct a comment
There's a world of difference between "any" and "only".
2020-03-08 12:10:12 +09:00
Bill Currie
b2faca16a7 [qfcc] Rename the kill alias functions
Having "visit" in the name felt redundant in the end.
2020-03-08 12:08:56 +09:00
Bill Currie
c2ed6d41bd [qfcc] Finish struct-init-param test
When the bug is fixed, it will pass now (does without optimization).
2020-03-08 03:55:08 +09:00
Bill Currie
e4c87091a3 [qfcc] Lots of flow analysis docs
And some function shuffling for grouping. I'm not satisfied with the
docs, but they're a lot more helpful than they were.
2020-03-08 03:53:53 +09:00
Bill Currie
809c103fd1 [qfcc] Shuffle some code around to be clearer
Doing the same thing at the end of two branches of an if/else seems off.

And doing an associative(?) set operation every time through a loop is
wasteful.
2020-03-08 03:46:52 +09:00
Bill Currie
7338689146 [qfcc] Treat offset real tempops as an error
tempops always have an offset field, but only those that are aliases
should ever have a non-zero offset.
2020-03-08 03:42:18 +09:00
Bill Currie
d44d956038 [qfcc] Remove a long dead function 2020-03-08 03:39:24 +09:00
Bill Currie
f56de00c21 [qfcc] Rename a field
depth_first is much clearer than dfo. I had to check what dfo meant too
many times in one night.
2020-03-08 03:38:45 +09:00
Bill Currie
2b15e61b28 [qfcc] Remove obsolete structure fields
init_vars hasn't been used for a long time.
2020-03-08 03:33:01 +09:00
Bill Currie
e524db1fc1 [qfcc] Set op type when aliasing a value
This fixes the ICE when attempting to compile address-cast without
optimization (just realized why, too: the assignment was optimized out
of existence).
2020-03-08 03:11:46 +09:00
Bill Currie
6ada20f685 [qfcc] Show offset for op_x_def_ofs relocs 2020-03-07 02:06:33 +09:00
Bill Currie
48514ba2f3 [qfcc] Create alias def for defs accessed via pointer
This the fixes the incorrect flow analysis caused by the def being seen
to have the wrong size (structure field of structure def seen through a
constant pointer). Fixes the ICE, but the pointer constant is broken
somewhere in dags, presumably.
2020-03-07 01:30:36 +09:00
Bill Currie
faa6eabfbe [qfcc] Add a failing test for struct init to param
This actually took a bit to reproduce.
2020-03-06 22:28:04 +09:00
Bill Currie
f7757cf894 [qfcc] Add filename to dot output
It makes things so much easier when viewing the graphs
2020-03-06 21:05:53 +09:00
Bill Currie
de06efa604 [qfcc] Fix handling of nil for static initializers
nil is most definitely constant.
2020-03-06 20:38:40 +09:00
Bill Currie
9dbc81432a [qfcc] Use full type for differentiating values
This fixes the problem of using nil for two different compound types
within the one expression. The problem is all compound types have the
same low-level type (ev_invalid) and this caused the two different nils
to have the same type when taken back up to expression level.
2020-03-06 20:33:47 +09:00
Bill Currie
07e6baf32f [qfcc] Support { } as nil in nested initializers
Did top-level earlier, but forgot to add support for deeper nestings.
2020-03-06 20:32:37 +09:00
Bill Currie
9b269c2f8e [qfcc] Fix mangled method parameters
Method parameters (ie, extra parameters without selector names) were
getting reversed during function type construction.
2020-03-06 17:37:58 +09:00
Bill Currie
a2cebe3cac [qfcc] Add failing test for method parameters 2020-03-06 17:36:23 +09:00
Bill Currie
94e35b5f57 [qfcc] Clean up error messages around superclass 2020-03-05 21:10:15 +09:00
Bill Currie
66b8ab6890 [qfcc] Rework method ivar access
While expression symbols worked for what they are, they weren't so good
for ivar access because every ivar of a class (and its super classes)
would be accessed at method scope creation, generating spurious access
errors if any were private. That is, when the access checks worked at
all.
2020-03-05 18:45:47 +09:00
Bill Currie
5200c3f518 [qfcc] Update chewed-alias test for new warnings 2020-03-05 18:26:11 +09:00
Bill Currie
1bf56b28ac [qfcc] Warn when messaging a forward-declared class
But only once.
2020-03-05 15:39:34 +09:00
Bill Currie
59db90d177 [qfcc] Fix method not found warnings
It turns out they should not be optional, but do need to be smarter
about when and which. So another two FIXMEs gone :)
2020-03-05 14:48:53 +09:00
Bill Currie
669c8f43d8 whitespace 2020-03-05 14:48:49 +09:00
Bill Currie
ccaa4ad3d2 [qfcc] Catch assignment of void* to class pointers
id and other class pointers imply that the object can receive messages,
but void * has no such implication, so treat it as a mismatch.
2020-03-05 14:14:20 +09:00
Bill Currie
65a5e4f2a4 [qfcc] Allow inherited methods to satisfy protocols
I suspect that the current state of things will produce problems later
on, but this works for now.
2020-03-05 12:52:37 +09:00
Bill Currie
1459361cbd [qfcc] Set builtin function def flags
This fixes the missing redefinition error when a builtin is defined
twice (and thus corrupting the function chain).
2020-03-05 11:48:15 +09:00
Bill Currie
9ccfe8aefc [qfcc] Rewrite init_elements
The end goal was to fix erroneous non-constant initializer errors for
the following (ie, nested initializer blocks):

    typedef struct { int x; int y; } Point;
    typedef struct { int width; int height; } Extent;
    typedef struct Rect_s { Point offset; Extent extent; } Rect;
    Rect makeRect (int xpos, int ypos, int xlen, int ylen)
    {
	Rect rect = {{xpos, ypos}, {xlen, ylen}};
	return rect;
    }

However, it turned out that nested initializer blocks for local
variables did not work at all in that the relocations were lost because
fake defs were being created for the generated instructions.

Thus, instead of creating fake defs, simply record the offset relative
to the base def, the type, and the basic type initializer expression,
then generate instructions that all refer to the correct def but with a
relative offset.

Other than using the new element system, static initializers are largely
unaffected.
2020-03-05 11:05:13 +09:00
Bill Currie
1b2a806f28 [qfcc] Fix test that failed due to improved warnings 2020-03-05 11:04:22 +09:00
Bill Currie
78b71c28fe [qfcc] Make reloc functions const-correct 2020-03-05 11:03:23 +09:00
Bill Currie
efcbbbb641 [qfcc] Catch use of missing superclass interfaces 2020-03-05 08:50:29 +09:00
Bill Currie
896c14f33a [qfcc] Support anonymous structs in ivars
Missed this earlier.
2020-03-05 08:47:21 +09:00
Bill Currie
0bb4279a9f [qfcc] Handle bitwise not of enums
It looks like I need to handle other unary expressions too, but another
time.
2020-03-05 01:45:38 +09:00
Bill Currie
269a8a558a [qfcc] Allow bare enum and named struct declarations
Got a little overzealous there
2020-03-04 18:39:41 +09:00
Bill Currie
f532780dbe [qfcc] Treat opaque structs as not anonymous
I don't know why the segfault happened where it did, but
forward-declared structs certainly can't be used as anonymous structs.
2020-03-04 18:38:04 +09:00
Bill Currie
7a2335e9f4 [qfcc] Catch useless specifiers in function scope 2020-03-04 18:07:10 +09:00
Bill Currie
4c82114547 [qfcc] Catch several useless specifier expressions 2020-03-04 17:40:49 +09:00
Bill Currie
597890dda1 [qfcc] Catch duplicate field definitions 2020-03-04 16:32:04 +09:00
Bill Currie
e298904dc0 [qfcc] Implement anonymous structs and unions
For struct/union scope
2020-03-04 16:31:28 +09:00
Bill Currie
4fa203852a [qfcc] Use offset alias offset when creating alias of offset alias
Yes, that's correct. It happens when casting the address of a structure
field (for the test case this fixes, vector field).
2020-03-04 00:55:31 +09:00
Bill Currie
57b2751732 [qfcc] Add failing vector element address test
It's an evil thing to do, but it should at least work.
2020-03-04 00:37:10 +09:00
Bill Currie
b186332da0 [qfcc] Make initialization of external vars an error 2020-03-03 17:33:56 +09:00
Bill Currie
6def1fc01c [qfcc] Fix a bootstrap warning 2020-03-03 15:26:33 +09:00
Bill Currie
b8984e5f66 [qfcc] Fix another infinite loop in the linker
I think this should be it for infinite loops caused by undefined
symbols. I don't know why I didn't remove this continue when I removed
the other.
2020-03-03 13:39:24 +09:00
Bill Currie
c7cde5f409 [qfcc] Pass gcc's purity test
*sigh*
2020-03-03 10:59:01 +09:00
Bill Currie
16223098e5 [qfcc] Fix ivar visibility
It was broken by the big rewrite and I forgot to fix it.
2020-03-03 10:42:05 +09:00
Bill Currie
ed04e6fc23 [qfcc] Merge method lists instead of copying
This is for adding methods to classes and protocols via their interface,
not for adding methods by adding protocols (they still get copied).
Slightly more memory efficient.
2020-03-03 00:11:54 +09:00
Bill Currie
f025bd96d4 [qfcc] Copy self param when copying methods
Copying methods is done when adding protocols to classes (the current
use for adding regular methods is an incorrect solution to a different
problem). However, when a method is added to a class, the type of its
self parameter is set to be a pointer to the class. Thus, not only does
the method need to be copied, the self parameter does too, otherwise
the self parameter of methods added via protocols will have their type
set to be a pointer to the last class seen adding the protocol.

That is, if, while compiling the implementation for class A, but the
interface for class B is comes after the interface for class A, and both
A and B add protocol P, then all methods in protocol P will have self
pointing to B rather than A.

@protocol P
-method;
@end

@interface A <P>
@end

@interface B <P>
@end

@implementation A
-method	{} // self is B, not A!
@end
2020-03-02 23:46:26 +09:00
Bill Currie
8a4de6fea6 [qfcc] Fix segmentation fault for parameter errors 2020-03-02 22:38:12 +09:00
Bill Currie
f6d650d473 [qfcc] Merge duplicate methods in interfaces
Duplicate methods in an interface (especially across protocols and
between protocols and the interface) are both harmless and even to be
expected. They certainly should not cause the compiler to demand
duplicate method implementations :)
2020-03-02 21:15:21 +09:00
Bill Currie
e33d83fc9e [qfcc] Accept "struct foo; struct foo { ... };"
That is, do not treat structure definition after declaration to be a
redefinition.
2020-03-02 20:16:29 +09:00
Bill Currie
5893bd7501 [qfcc] Catch erroneous negative builtin numbers
Setting a builtin number negative makes it a non-builtin function, but
possibly in the middle of another function. Not good.
2020-03-02 13:47:46 +09:00
Bill Currie
0db617719e [qfcc] Improve error messages for bad qc builtins
While global quakec functions could not be initialized to another
function, the error messages were rather obscure.
2020-03-02 13:47:46 +09:00
Bill Currie
9ccff74fcf [qfcc] Emit only one instance per protocol per module
This is actually a double issue: when a class implementing a protocol
used the protocol in @protocol(), not only would the protocol get
emitted as part of the class data specifying that the class conforms to
the protocol, a second instance would be emitted again when @protocol()
was used. On top of that, only the instance referenced by @protocol()
would be initialized. Now, both class emission and @protocol() get their
protocol def from the same place and thus only one, properly
initialized, protocol instance is emitted.
2020-03-02 10:55:46 +09:00
Bill Currie
8021613b79 [qfcc] Fix missing protocol method lists
The problem was an erroneous assumption that the methods had to be
defined. Any class implementing a protocol must implement (and thus
define) the methods, but a protocol declaration cannot: it merely
declares the methods, and it's entirely possible for a module to see
only the protocol definition and not any classes implementing the
protocol.
2020-03-02 10:52:09 +09:00
Bill Currie
b6b7f9675f [qfcc] Emit static instance lists
For now, only protocols are in the list (gcc adds only static string
objects and qfcc doesn't do those yet, so not so far behind). qfprogs
dumps them.
2020-03-02 10:48:51 +09:00
Bill Currie
544d7de1ec [qfcc] Implement @protocol(foo)
Unlike gcc, qfcc requires foo to be defined, not just declared (I
suspect this is a bug in gcc, or even the ObjC spec), because allowing
forward declarations causes an empty (no methods) protocol to be
emitted, and then when the protocol is actually defined, one with
methods, resulting in two different versions of the same protocol, which
comments in the gnu objc runtime specifically state is a problem but is
not checked because it "never happens in practice" (found while
investigating gcc's behavior with @protocol and just what some of the
comments about static instance lists meant).
2020-03-02 10:42:26 +09:00
Bill Currie
254bf29bd4 [qfcc] Handle protocol forward declarations 2020-03-01 19:37:40 +09:00
Bill Currie
80d9401eee [qfcc] Report errors for objects in function decls
The number of time's I've forgotten the * in a declaration in objective
code (probably thanks to C#'s lack of them).
2020-03-01 17:44:13 +09:00
Bill Currie
b544321609 [qfcc] Catch deferences to incomplete types
Reporting an error is so much more helpful than segmentation fault.
2020-03-01 17:43:28 +09:00
Bill Currie
277c64a460 [qfcc] Correct a typo 2020-03-01 17:28:51 +09:00
Bill Currie
caa297b756 [qfcc] Remove type alias encoding
It proved to be too fragile in its current implementation. It broke
pointers to incomplete structs and switch enum checking, and getting it
to work for other things was overly invasive. I still want the encoding,
but need to come up with something more robust.a
2020-03-01 16:13:18 +09:00
Bill Currie
1033716b2b [qfcc] Fix some curly space 2020-03-01 13:53:18 +09:00
Bill Currie
df2ed4b086 [qwaq] Move from tools to ruamoko
This fixes the dependency issues between qwaq and ruamoko. qwaq is
actually older than ruamoko. That little language feature test has come
a long way.

However, I'm considering moving to non-recursive make, but...
2020-03-01 00:55:15 +09:00
Bill Currie
c079eb851b [qwaq] Start work on the actual app
It doesn't look good, but it does have panel based windows working, and
using objects. Won't build reliably right now due to qwaq being in tools
and thus building before ruamoko, but I'll fix that next.
2020-03-01 00:40:55 +09:00
Bill Currie
271d836cd2 [qfcc] Catch static class instances in structs 2020-02-29 21:09:24 +09:00
Bill Currie
e93ca9d828 [qfcc] Fix infinite loop in linker 2020-02-29 20:13:25 +09:00
Bill Currie
8b6d05a4dd [qwaq] Ensure mouse motion reporting gets turned off
It seems that xterm automatically disables it when ncurses shuts down and
mate-terminal does not, or maybe a different version of something. Still,
good to clean up properly.
2020-02-29 16:36:23 +09:00
Bill Currie
ae532870c4 [qwaq] Implement basic color support 2020-02-29 14:48:18 +09:00
Bill Currie
ec4e9b326d [qwaq] Don't call wrefresh in cmd_mvwaddstr
There is now an implementation for wrefresh.
2020-02-29 14:43:08 +09:00
Bill Currie
f5f50ae231 [qwaq] Make stdscr available to progs 2020-02-29 14:38:54 +09:00
Bill Currie
5e4677f8d5 [qwaq] Implement the immediately useful panel functions 2020-02-29 13:06:58 +09:00
Bill Currie
17005637ca [qwaq] Rename the internal function names
Now they reflect the curses functions they wrap. The externally visible
builtin names are not changed because the parameters are in x, y order
rather than curses' y, x order.
2020-02-29 12:52:13 +09:00
Bill Currie
ea69921e6a [qwaq] Validate window before acquiring string
If the window is invalid and recovery is done, string ids will leak if
acquired before validation.

Afterwards, make the rest of the builtin wrappers consistent: extract
parameters, validate, [acquire resources], generate command.
2020-02-29 12:33:45 +09:00
Bill Currie
0119660b01 [qwaq] Convert remaining functions to command queue
Now that the initial prototype seems to be working well, it's time to
implement more commands. I might have to do some wrappers for actual
command writing (and result reading) as it looks like there will be a
lot of nearly identical code.
2020-02-29 11:44:43 +09:00
Bill Currie
513c808875 [qwaq] Make some bad ascii art 2020-02-29 02:07:47 +09:00
Bill Currie
bd98d1d9fb [qwaq] Prepare for threading
So far, no threading has been set up, and only window creation and
printing have been updated, but the basics of the design seem to be
sound.

The builtin functions now no longer call ncurses directly: the build
commands and write them to a command buffer.

Commands that have return values (eg, window creation) write their
results to a results buffer that the originating builtin function
reads. Builtin functions that expect a result "poll" the results buffer
for the correct result (marked by the same command). In a single
UI-thread environment, the results should always be in the same order as
the commands, and in a multi-UI-thread environment, things should
(fingers crossed) sort themselves out as ONE of the threads will be the
originator of the next available result.

Strings in commands (eg, for printing) are handled by acquiring a string
id (index into an array of dstring_t) and including the string id in the
written command. The string id is released upon completion of the
command.

Builtin functions write commands, acquire string ids, and read results.

The command processor reads commands, releases string ids, and writes
results.

Since commands, string ids, and results are all in ring buffers, and
assuming there is only one thread running the builtin functions and only
one thread processing commands (there can be only one because ncurses is
not thread-safe), then there should never be any contention on the
buffers. Of course, if there are multiple threads running the builtin
functions, then locking will be required on the builtin function side.
2020-02-29 01:45:33 +09:00
Bill Currie
644ef93dde [qwaq] Create some ring-buffer macros
I expect I will need several messaging buffers, and ring buffers tend to
be quite robust. Replacing the event buffer code with the macros made
testing easy.
2020-02-28 22:27:29 +09:00
Bill Currie
6a58dcdddd [qwaq] Fix lost output
Turns out all I needed was a refresh() after initialization.
2020-02-27 21:38:55 +09:00
Bill Currie
dd25bf5dfe [qwaq] Read mouse movements
Many thanks to https://gist.github.com/sylt/93d3f7b77e7f3a881603 for the
necessary escape sequence to get xterm reporting mouse movement events.
2020-02-27 21:22:10 +09:00
Bill Currie
a3ed5926b9 [qwaq] Remove unnecessary fields from mouse events
id and z seem to always be 0.

Ironically, it turns out that the work needed for "int id" and "large"
struct nil init wasn't strictly necessary to get to this point, but
without having done that work, I wouldn't know :)
2020-02-27 21:08:12 +09:00
Bill Currie
08bf8a04e4 [qwaq] Implement an event queue
It seems to have an issue with a bogus clearing of the screen, but the
basics seem to be working.
2020-02-27 21:07:56 +09:00
Bill Currie
b4aebc120e [qfcc] Treat { } as nil for initializing compound types 2020-02-27 20:30:39 +09:00
Bill Currie
7c9072aebf [qfcc] Create struct fields for "type typename"
Such declarations were being lost, thus in the following, the id field
never got added:
typedef struct qwaq_mevent_s {
    int         id;
    int         x, y, z;
    int         buttons;
} qwaq_mevent_t;
2020-02-27 17:50:11 +09:00
Bill Currie
dbbb8a1396 [qfcc] Fix syntax error for id as a field name
event.e.mouse.id produced a syntax error, which is contrary to
Objective-C.
2020-02-27 17:43:39 +09:00
Bill Currie
e8c357393f [qwaq] Clear qwaq's print buffer
Didn't realized PR_Sprintf appended. Or, more likely, I had forgotten
because I imagine Deek and I discussed it at the time.
2020-02-27 02:11:54 +09:00
Bill Currie
edde4bad15 Create a basic hello world
And it has begun. It has some problems, but worse, it seems I broke
qfprogs and maybe pr_debug.c.
2020-02-27 01:18:38 +09:00
Bill Currie
126f8502bd Start working on a qwaq console tool
The intention is it will hopefully become a debugger. It will certainly
help with development of the progs engine.
2020-02-26 22:10:59 +09:00
Bill Currie
4cec3bbff6 Unalias types when checking cast-compatibility
This fixes the problem with passing typedefs to function parameters.
2020-02-26 17:49:09 +09:00
Bill Currie
69b5029de5 Throw away function parameter type alias info
typedef is meant to create a simple renaming of a potentially complex
type, not create a new type. Keeping the parameter type alias info makes
the types effectively different when it comes to overloaded function
resolution, which is quite contrary to the goal. Does expose some
breakage elsewhere, though.
2020-02-26 17:46:53 +09:00
Bill Currie
9528c1176e Rename cast_expr's type vars for better clarity 2020-02-26 17:45:08 +09:00
Bill Currie
5c36c60005 Use type check helpers some more 2020-02-26 17:41:45 +09:00
Bill Currie
5d302ff6f4 Fix incorrect usage of signed verbosity 2020-02-26 17:15:52 +09:00
Bill Currie
35c9d6ee38 Make pr_obcode.c mostly thread safe
Its public data is all read-only, and once set up, its private data is
too (just don't call init in multiple threads).
2020-02-26 01:20:28 +09:00
Bill Currie
66dd3ef070 Make a bunch of count things positive-only
This fixes a pile of FIXMEs, because some things should never be
negative.
2020-02-25 21:23:13 +09:00
Bill Currie
282132958f Relocate local def type encodings in debug load
For technical reasons (programmer laziness), qfcc does not fix up local
def type encodings when writing the debug symbols file (type encoding
location not readily accessible).
2020-02-25 20:46:01 +09:00
Bill Currie
89e83d7d73 Move the debug info out of progs_t
The debug subsystem now uses the resources system to ensure it cleans
up, and its data is now semi-private. Unfortunately, PR_LoadDebug had to
remain public for qfprogs because using PR_RunLoadFuncs would cause
builtin resolution to complain.
2020-02-25 20:07:29 +09:00
Bill Currie
ca6fe0730b Fix qfcc test harness tracing
Just a consequence of progs execution state being initialized properly.
2020-02-25 19:02:24 +09:00
Bill Currie
a55b9544ac Improve handling of pr_argc
It is now set to 0 when progs are loaded and every time
PR_ExecuteProgram() returns. This takes care of the default case, but
when setting parameters, pr_argc needs to be set correctly in case a
vararg function is called.
2020-02-25 17:36:29 +09:00
Bill Currie
256dee98a1 Make progs string resources management private
Strangely enough, using the progs resources system. This is a step
towards having progs that can be reset properly, or even dynamically
created VMs.
2020-02-25 00:23:08 +09:00
Bill Currie
1cfac0f11a Resolve local def type encodings
They need to be resolved at load-time.
2020-02-25 00:12:02 +09:00
Bill Currie
c51c9edd9d Fix incorrect encoding of local defs 2020-02-25 00:11:01 +09:00
Bill Currie
7406e0308e Fix some warnings picked up in an optimized build 2020-02-24 11:28:43 +09:00
Bill Currie
c43b9681eb Keep structure members aligned 2020-02-24 08:43:32 +09:00
Bill Currie
2adcad7c84 Allow non-short-circuited logic to work 2020-02-24 02:25:28 +09:00
Bill Currie
ac32bbca40 Improve code for short-circuited float logic 2020-02-24 02:14:44 +09:00
Bill Currie
9c26d12f95 Cast rather than alias for testing constants
Fixes ICE in do { ... } while (1);
2020-02-24 02:13:23 +09:00
Bill Currie
55e53211e2 Generate default type expressions for folded booleans 2020-02-24 02:11:31 +09:00
Bill Currie
d6752c254c Move short-circuit boolean code to its own file 2020-02-24 01:20:24 +09:00
Bill Currie
0bf7ec07b7 Make debug output verbosity 2
and internal diagnostic sources level 1.
2020-02-24 00:22:13 +09:00
Bill Currie
11365024d2 Fix writing of frames files when not requested
I forgot to check for the option for separate compilation.
2020-02-24 00:07:48 +09:00
Bill Currie
27ae5ccfce Fix ICE after incomplete type error
Attempting to define a variable with an incomplete type is an error, and
results in a default size 1 of allocated, but I forgot to set default
alignment when implementing alignment.
2020-02-24 00:07:39 +09:00
Bill Currie
f387b9aa47 Propagate implicit for negating double constants 2020-02-23 23:41:12 +09:00
Bill Currie
5374798ef9 Fix order of operations for implicit casts 2020-02-23 23:18:31 +09:00
Bill Currie
05f6ddbb13 Print promoted warnings as errors
This makes it much easier to see why a compilation failed when only
warnings are visible.
2020-02-23 23:10:56 +09:00
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
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
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
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
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