Cygwin build fix
Vibhu Mohindra <[email protected]> Sun, 25 Sep 2022 03:40:23 +0200
| Newsgroups | gmane.lisp.clisp.devel |
|---|---|
| Message-ID | <VI1PR06MB4320707288812D5DF6026BB4CA539@VI1PR06MB4320.eurprd06.prod.outlook.com> |
--------------07fuKoywrofsnsEx0a0jXAxC
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi,
I've found and fixed a problem in lispbibl.d. I've attached an
indicative diff of the C file.
System: Windows 10, a fresh Cygwin, and the latest GitLab clisp.
I followed the instructions in INSTALL.windows ("3. Binaries for the
Cygwin environment"), for 64-bit binaries. Besides the prescribed
configure options, I added --ignore-absence-of-libsigsegv.
Make fails to produce spvw.o because lispbibl.c does this near line 1900:
#define CR 13
and then #includes a file (unix.c) that ultimate #includes
/usr/include/w32api/winnt.h
which itself has a legitimate symbol (not macro) named CR that gets
replaced by 13 resulting in a syntax error.
My fix is to move the whole #define block a few lines down to after the
#include block. That prevents the #define macros from inadvertently
capturing symbols from the included files.
----
I'm not an expert C programmer, but this technique of #including a file
after #defining a macro seems wrong in general. It makes changing the
included file impossibly hard as its author isn't free to use any new
symbols without fearing that an includer like clisp will capture them.
If clisp files followed a rule of never allowing #includes to follow
#defines, but to only ever precede them, I think that would consistently
prevent this particular sort of variable capture regardless of the depth
of an include hierarchy. An alternative prevention would be if include
file authors only created symbols with some namespace prefix, though
that would make their code unreadable.
With best wishes,
Vibhu
--------------07fuKoywrofsnsEx0a0jXAxC
Content-Type: text/x-patch; charset=UTF-8; name="lispbibl.c.diff"
Content-Disposition: attachment; filename="lispbibl.c.diff"
Content-Transfer-Encoding: base64
LS0tIGxpc3BiaWJsLmMub3JpZwkyMDIyLTA5LTI0IDE4OjM5OjA4LjUyNDA1NjIwMCArMDAwMAor
KysgbGlzcGJpYmwuYwkyMDIyLTA5LTI0IDIwOjAwOjM5LjAzMDgyNjIwMCArMDAwMApAQCAtMTg5
NCwxMyArMTg5NCw2IEBACiAKIC8q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GVmaW5lIENSICAgMTMgIC8qICAjXFJl
dHVybiAgICAgICAgY2FycmlhZ2UgcmV0dXJuICovCisjZGVmaW5lIFBHICAgMTIgIC8qICAjXFBh
Z2UgICAgICAgICAgZm9ybSBmZWVkLCBuZXcgcGFnZSAqLworCiAKIAogCg==
--------------07fuKoywrofsnsEx0a0jXAxC
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--------------07fuKoywrofsnsEx0a0jXAxC
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel
--------------07fuKoywrofsnsEx0a0jXAxC--