tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Fwd: tinycc


From: Thomas Preud'homme
Subject: [Tinycc-devel] Fwd: tinycc
Date: Thu, 31 Jan 2013 11:10:41 +0100
User-agent: KMail/1.13.7 (Linux/3.2.0-4-amd64; KDE/4.8.4; x86_64; ; )

--- Begin Message --- Subject: tinycc Date: Wed, 30 Jan 2013 20:09:54 +0100 User-agent: Mutt/1.5.17+20080114 (2008-01-14)
As you are going to prepare a tcc release here are some notes (all based on
mob branch):

toplevel Makefile still has some hardcodd uses of gcc in it, but uses
$(CPPFLAGS) $(CFLAGS) -> whenever one configures with a different compiler
(configure --cc=whatever) and that compiler uses CPPFLAGS/CFLAGS which gcc
doesn't know (and/or gcc isn't installed at all) compilations fails:

chao% echo $CC
clang

chao% echo $CFLAGS
-O0 -std=c99 -pedantic -W -Wall -Wextra -Wcast-align
-Wconstant-logical-operand -Wconditional-uninitialized
chao% echo $CPPFLAGS

chao% grep -n gcc Makefile
237:    gcc -c $< -o $@ $(CPPFLAGS) $(CFLAGS)

chao% make
[...]
gcc -c lib/bcheck.c -o bcheck.o -I.  -O0 -std=c99 -pedantic -W -Wall -Wextra
-Wcast-align -Wconstant-logical-operand -Wconditional-uninitialized
-fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare
-mpreferred-stack-boundary=2 -march=i386 -falign-functions=0 -m32
gcc: error: unrecognized command line option ‘-Wconstant-logical-operand’
gcc: error: unrecognized command line option ‘-Wconditional-uninitialized’
make: *** [bcheck.o] Error 1


lib/Makefile also has some hardcoed usages of gcc:

chao% grep -n gcc Makefile
19:             XCC = gcc -O2 -m32
25:             XCC = gcc -O2 -m64

unfortunately libtcc1.c relies on gcc, clang for example gives a lot of
erros:
libtcc1.c:172:16: error: invalid use of a cast in a inline asm context
requiring
      an l-value: remove the cast or build with -fheinous-gnu-extensions
          udiv_qrnnd (q0, n0, n1, n0, d0);
          ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
libtcc1.c:130:24: note: expanded from macro 'udiv_qrnnd'
           : "=a" ((USItype) (q)),                                      \
                   ~~~~~~~~~~~^~
[...]

adding -fheinous-gnu-extensions fixes the problem, but IMHO one should
avoid relying on gnu-extensions to be portable.

There are hardcoded gcc specific CFLAGS in variuos places which lead to
errors if configuring with compilers which do not understand them, i.e.
icc:

chao% find . -name 'Makefile' | xargs grep -n preferred-stack-boundar 
./Makefile:25:CFLAGS+=-mpreferred-stack-boundary=2

chao% make
icc -o tcc.o -c tcc.c -DTCC_TARGET_I386
-DCONFIG_MULTIARCHDIR=\"i386-linux-gnu\"   -I.  -Os -Wall -Wcheck -w2
-diag-disable 147,167,171,181,193,279,810,981,1682,1683,2259
-fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare
-mpreferred-stack-boundary=2 -march=i386 -falign-functions=0 -m32
icc: command line warning #10156: ignoring option '-W'; no argument required
icc: command line warning #10156: ignoring option '-W'; no argument required
icc: command line error: option '-mpreferred-stack-boundary=' not supported

Overall clang / gcc show a lot of warnings (platform is i686-pc-linux-gnu):
CFLAGS for clang 3.1:
        -O0 -std=c99 -pedantic -W -Wall -Wextra -Wcast-align 
        -Wconstant-logical-operand -Wconditional-uninitialized
CFLAGS for gcc (4.7.2):
        -std=c99 -O2 -Wextra -pipe -pedantic -Wall -Winline -Wshadow
        -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
        -Wbad-function-cast -Wnested-externs -Wcast-align -Wpointer-arith
        -Waggregate-return -Wcast-qual -Wwrite-strings -Wundef -Wpacked
        -Wfloat-equal -Wendif-labels -Wunused-macros
        -Wdeclaration-after-statement -Wold-style-definition -Winit-self
        -Wmissing-include-dirs -Woverride-init -Wlogical-op -Wvla
        -Wjump-misses-init -Wformat=2 -Wunused-local-typedefs
        -ftrack-macro-expansion -Wno-format-nonliteral -Wno-format-security
        -Wno-unused-result

I didn't go through the pain to test with icc, suncc, nwcc, pgcc, opencc
(all available for free).

HTH,
urs

--- End Message ---

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]