Watcom and/or QNX cc wrapper bug?

summary:
while compiling a big open source project, I noticed watcom c/c++
compiler doesn’t like any extra spaces on the command line.

the below example shows the bug.

mytest.c:

#include <stdio.h>
main()
{
printf(“macro=%d\n”, MYDEF);
}

With gcc:
gcc -DMYDEF=’ 2*3 ’ -o mytest mytest.c
…/mytest
macro=6

Now with Watcom:
cc -DMYDEF=’ 23 ’ -o mytest mytest.c
/usr/watcom/10.6/bin/wcc386 -zq -d+ -dMYDEF= 2
3 -ms -4r -i=/usr/watcom/10.6/usr/include -i=/usr/include mytest.c
Error! E1139: Command line contains more than one file to compile
Unable to open ‘2*3 .c’
cc: /usr/watcom/10.6/bin/wcc386 exited 1

you may notice that the QNX cc wraper stripped out the quotes for ’ 23 ’
when calling the “wcc386”. Of course,
wcc386 … -dMYDEF= 2
3 -ms …
will fail.

So we can conclude it is a bug with the QNX cc wrapper to Watcom.
(bug 1)

Now let’s do a bit more testing and add those quotes manually to wcc386:
/usr/watcom/10.6/bin/wcc386 -zq -d+ -dMYDEF=’ 23 ’ -ms -4r -i=/usr/include mytest.c
Error! E1139: Command line contains more than one file to compile
Unable to open '2
3 .c’

looks like Watcom has a bug too.

Real world example:
compiling XFree86 4.x on QNX4.25 with Watcom C/c++ 10.6:

cc -O -5s -Otx -Wc,-r -b -j -Wc,-ei -N128000 -zp4 -mf -I…/…/…/…/… -I…/…/…/…/…/exports/include -DQNX4 -DQNX -D__QNX__ -DNO_REGEX -DSTRINGS_ALIGNED -D__i386__ -D_POSIX_SOURCE -DFUNCPROTO=15 -DNARROWPROTO -DCARD_DATABASE_FILE=’"/usr/X11R6/lib/X11/Cards"’ -DXKB_RULES_DIR="/usr/X11R6/lib/X11/xkb/rules" -DXCONFIGFILE=“XF86Config” -DXVERSION="((( 4 )* 10000000 )+((1)*100000)+((99)1000)+4)" -c xf86config.c
/usr/watcom/10.6/bin/wcc386 -zq -oil -otx -j -i=…/…/…/…/… -i=…/…/…/…/…/exports/include -d+ -dQNX4 -dQNX -d__QNX__ -dNO_REGEX -dSTRINGS_ALIGNED -d__i386__ -d_POSIX_SOURCE -dFUNCPROTO=15 -dNARROWPROTO -dCARD_DATABASE_FILE="/usr/X11R6/lib/X11/Cards" -dXKB_RULES_DIR="/usr/X11R6/lib/X11/xkb/rules" -dXCONFIGFILE=“XF86Config” -dXVERSION=((( 4 )
10000000 )+((1)*100000)+((99)1000)+4) -mf -r -ei -zp4 -5s -i=/usr/watcom/10.6/usr/include -i=/usr/include xf86config.c
Error! E1139: Command line contains more than one file to compile
Error! E1139: Command line contains more than one file to compile
Error! E1139: Command line contains more than one file to compile
Error! E1139: Command line contains more than one file to compile
Unable to open '4 )
10000000 )+((1)*100000)+((99)*1000)+4).c’
cc: /usr/watcom/10.6/bin/wcc386 exited 1

I have to take out all the extra spaces for
-DXVERSION="((( 4 )* 10000000 )+((1)*100000)+((99)*1000)+4)"

btw, the
-DXVERSION is expanded from a macro in X.

#define XF86_VERSION_MAJOR 4
#define XF86_VERSION_MINOR 1
#define XF86_VERSION_PATCH 99
#define XF86_VERSION_SNAP 4

#define XF86_VERSION_NUMERIC(major,minor,patch,snap,dummy)
(((major) * 10000000) + ((minor) * 100000) + ((patch) * 1000) + snap)
#define XF86_VERSION_CURRENT
XF86_VERSION_NUMERIC(XF86_VERSION_MAJOR,
XF86_VERSION_MINOR,
XF86_VERSION_PATCH,
XF86_VERSION_SNAP,
0)




Error! E1139: Command line contains more than one file to compile

LiuG <liug@mama.indstate.edu> wrote:

summary:
while compiling a big open source project, I noticed watcom c/c++
compiler doesn’t like any extra spaces on the command line.

Well… it doesn’t like them in macro definitions. But, yes.

wcc386 comes from a DOS background, and probably has its own “tokenizer”
built-in, that isn’t quite bright enough.

Yes, it’s a bug.

No, unfortunately I don’t think it will ever get fixed.

-David


the below example shows the bug.

mytest.c:

#include <stdio.h
main()
{
printf(“macro=%d\n”, MYDEF);
}

With gcc:
gcc -DMYDEF=’ 2*3 ’ -o mytest mytest.c
./mytest
macro=6

Now with Watcom:
cc -DMYDEF=’ 23 ’ -o mytest mytest.c
/usr/watcom/10.6/bin/wcc386 -zq -d+ -dMYDEF= 2
3 -ms -4r -i=/usr/watcom/10.6/usr/include -i=/usr/include mytest.c
Error! E1139: Command line contains more than one file to compile
Unable to open ‘2*3 .c’
cc: /usr/watcom/10.6/bin/wcc386 exited 1

you may notice that the QNX cc wraper stripped out the quotes for ’ 23 ’
when calling the “wcc386”. Of course,
wcc386 … -dMYDEF= 2
3 -ms …
will fail.

So we can conclude it is a bug with the QNX cc wrapper to Watcom.
(bug 1)

Now let’s do a bit more testing and add those quotes manually to wcc386:
/usr/watcom/10.6/bin/wcc386 -zq -d+ -dMYDEF=’ 23 ’ -ms -4r -i=/usr/include mytest.c
Error! E1139: Command line contains more than one file to compile
Unable to open '2
3 .c’

looks like Watcom has a bug too.

Real world example:
compiling XFree86 4.x on QNX4.25 with Watcom C/c++ 10.6:

cc -O -5s -Otx -Wc,-r -b -j -Wc,-ei -N128000 -zp4 -mf -I…/…/…/…/… -I…/…/…/…/…/exports/include -DQNX4 -DQNX -D__QNX__ -DNO_REGEX -DSTRINGS_ALIGNED -D__i386__ -D_POSIX_SOURCE -DFUNCPROTO=15 -DNARROWPROTO -DCARD_DATABASE_FILE=’"/usr/X11R6/lib/X11/Cards"’ -DXKB_RULES_DIR="/usr/X11R6/lib/X11/xkb/rules" -DXCONFIGFILE=“XF86Config” -DXVERSION="((( 4 )* 10000000 )+((1)*100000)+((99)1000)+4)" -c xf86config.c
/usr/watcom/10.6/bin/wcc386 -zq -oil -otx -j -i=…/…/…/…/… -i=…/…/…/…/…/exports/include -d+ -dQNX4 -dQNX -d__QNX__ -dNO_REGEX -dSTRINGS_ALIGNED -d__i386__ -d_POSIX_SOURCE -dFUNCPROTO=15 -dNARROWPROTO -dCARD_DATABASE_FILE="/usr/X11R6/lib/X11/Cards" -dXKB_RULES_DIR="/usr/X11R6/lib/X11/xkb/rules" -dXCONFIGFILE=“XF86Config” -dXVERSION=((( 4 )
10000000 )+((1)*100000)+((99)1000)+4) -mf -r -ei -zp4 -5s -i=/usr/watcom/10.6/usr/include -i=/usr/include xf86config.c
Error! E1139: Command line contains more than one file to compile
Error! E1139: Command line contains more than one file to compile
Error! E1139: Command line contains more than one file to compile
Error! E1139: Command line contains more than one file to compile
Unable to open '4 )
10000000 )+((1)*100000)+((99)*1000)+4).c’
cc: /usr/watcom/10.6/bin/wcc386 exited 1

I have to take out all the extra spaces for
-DXVERSION="((( 4 )* 10000000 )+((1)*100000)+((99)*1000)+4)"

btw, the
-DXVERSION is expanded from a macro in X.

#define XF86_VERSION_MAJOR 4
#define XF86_VERSION_MINOR 1
#define XF86_VERSION_PATCH 99
#define XF86_VERSION_SNAP 4

#define XF86_VERSION_NUMERIC(major,minor,patch,snap,dummy)
(((major) * 10000000) + ((minor) * 100000) + ((patch) * 1000) + snap)
#define XF86_VERSION_CURRENT
XF86_VERSION_NUMERIC(XF86_VERSION_MAJOR,
XF86_VERSION_MINOR,
XF86_VERSION_PATCH,
XF86_VERSION_SNAP,
0)



Error! E1139: Command line contains more than one file to compile





QNX Training Services
I do not answer technical questions by email.