Some fixes #31

Merged
pkulev merged 5 commits from review-fixes into main 2026-09-23 22:14:19 +02:00
Owner

Comments, type (tag/typedef) handling, feature (#- #+), error reporting.

Comments, type (tag/typedef) handling, feature (#- #+), error reporting.
alex-eg added 5 commits 2026-09-21 17:42:03 +02:00
A dropped datum is replaced by whatever follows it, but what follows
may be the end of the file or the paren closing the list we are
in. Hand the token back to the caller instead: read-list closes its
list with it and the toplevel loop stops.

A `;' comment between a guard and the form it guards was also taken for
the guarded datum, so the form stayed unconditional and the guard did
nothing. Skip comments when reading the guard.

comment-form? was defined three times over; it moves to utils.
C has two namespaces and the database had one. A typedef of a tag's
name wiped it.

Tags, i.e. struct, enum and union, share one namespace; they move to a
table of their own. A name resolves the way C does: the ordinary
identifier first, the tag when that leads nowhere.

While resolving a typedef, the target was taken apart with cadr
whatever it was, so (typedef points (¤ point 4)) reported point's
fields as its own -- an array of four points claiming to be a point,
and a macro reaching through it with v->x. Only a name and
(struct|union|enum NAME) name a type now.
The guard against nested pointer chains searched every sublist for a
`*', including the ones that hold a type of their own.

A function type with a pointer parameter, while the same type with an int
parameter passed. (* [char 4]) was let through as well and came out
as `vector-ref char 4 * p'.

A `*' inside an array or a function type belongs to that type, so the
search stops there. What the flat conversion cannot express is now
named: a fn type is a function pointer already, and a pointer to an
array is not supported.

Parameters of a function type are walked without their names. C writes
a parameter name into a declarator and a type has none, so fmt-c prints
whatever it is handed there as a type: `(s (* char))' came out as
`char(*) s'.

fmt-c printed a nameless array declarator's #f into the C, which showed
up in these parameters.
read the feature flags in sextest in the way sexc does
Some checks failed
Sex CI / build-linux (pull_request) Failing after 5m14s
7ed1e99ab0
sextest resolves #+ and #- itself -- it reads the program and prints
what survives to sexc -- so a flag spelling it does not recognise
decides which branch gets compiled
alex-eg force-pushed review-fixes from 7ed1e99ab0 to ad7f358a8b 2026-09-21 17:51:07 +02:00 Compare
alex-eg requested review from pkulev 2026-09-22 00:13:39 +02:00
alex-eg force-pushed review-fixes from ad7f358a8b to e0987c1836 2026-09-23 13:37:28 +02:00 Compare
pkulev approved these changes 2026-09-23 22:14:13 +02:00
pkulev left a comment
Collaborator

🔥

🔥
pkulev merged commit e0987c1836 into main 2026-09-23 22:14:19 +02:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: alex-eg/sex#31