New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
camlidl's preprocessor #2837
Comments
Comment author: administrator
I was under the impression that # directives inside a string literal So at least do not use above (wrong) construct in your examples --
Sounds very reasonable. I'll do that. Best regards,
|
Comment author: administrator Xavier Leroy Xavier.Leroy@inria.fr writes:
Yes, gcc ignores preprocessor directives inside string literals, but msvc [test.c] D:\Work\camlidl-test>cpp test.c 1 "test.c"" D:\Work\camlidl-test>cl /nologo /E /Za test.c " Probably that's MSVC bug, because ISO C++ standard (don't have an ANSI C [---cut---] But anyway it's easier to work around this bug when wait until MS fix it Hope to hear from you soon, |
Comment author: administrator Fixed example as suggested. XL, 2001-07-30 |
Original bug ID: 436
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: -for CamlIDL use https://github.com/xavierleroy/camlidl/issues
Bug description
Full_Name: Dmitry Bely
Version: camlidl current cvs
OS: Windows NT 4.0
Submission from: d041.p3.col.ru (195.210.132.41)
test/unix.idl from camlidl distribution contains the following:
[---cut---]
quote(C,"
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <fcntl.h>
...
")
[---cut---]
these #include statements are interpreted by an external preprocessor, which
camlidl calls during .idl compilation and became expanded in the resulting .c
file. Obviously that's not what the programmer expected.
Ideal solution would be to ignore preprocessor directives inside qoute
statement, but I realize that it's almost impossible to implement for external
preprocessor. So at least do not use above (wrong) construct in your examples --
it should be written as
[---cut---]
quote(C,"#include <stdlib.h>")
quote(C,"#include <stdio.h>")
quote(C,"#include <sys/types.h>")
quote(C,"#include <sys/wait.h>")
quote(C,"#include <dirent.h>")
quote(C,"#include <unistd.h>")
quote(C,"#include <sys/stat.h>")
quote(C,"#include <sys/time.h>")
quote(C,"#include <fcntl.h>")
...
")
[---cut---]
The text was updated successfully, but these errors were encountered: