diff options
Diffstat (limited to 'mcon/U/Csym.U')
-rw-r--r-- | mcon/U/Csym.U | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/mcon/U/Csym.U b/mcon/U/Csym.U index 7327849..91aa8cc 100644 --- a/mcon/U/Csym.U +++ b/mcon/U/Csym.U @@ -1,11 +1,11 @@ -?RCS: $Id: Csym.U 1 2006-08-24 12:32:52Z rmanfredi $ +?RCS: $Id: Csym.U 167 2013-05-08 17:58:00Z rmanfredi $ ?RCS: ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi ?RCS: -?RCS: You may redistribute only under the terms of the Artistic Licence, +?RCS: You may redistribute only under the terms of the Artistic License, ?RCS: as specified in the README file that comes with the distribution. ?RCS: You may reuse parts of this distribution only within the terms of -?RCS: that same Artistic Licence; a copy of which may be found at the root +?RCS: that same Artistic License; a copy of which may be found at the root ?RCS: of the source tree for dist 4.0. ?RCS: ?RCS: $Log: Csym.U,v $ @@ -14,7 +14,7 @@ ?RCS: patch56: added quotes for OS/2 support ?RCS: ?RCS: Revision 3.0.1.3 1995/05/12 12:00:33 ram -?RCS: patch54: fixed C test program to bypasss gcc builtin type checks (ADO) +?RCS: patch54: fixed C test program to bypass gcc builtin type checks (ADO) ?RCS: ?RCS: Revision 3.0.1.2 1994/10/31 09:34:13 ram ?RCS: patch44: added Options to the MAKE line since it's no longer in Init.U @@ -26,7 +26,7 @@ ?RCS: Revision 3.0 1993/08/18 12:04:50 ram ?RCS: Baseline for dist 3.0 netwide release. ?RCS: -?MAKE:Csym: Options contains libc libs runnm +cc +ccflags +ldflags rm +?MAKE:Csym: Options contains cat libc libs runnm +cc +ccflags +ldflags rm ?MAKE: -pick add $@ %< ?LINT:define csym ?LINT:use libc @@ -41,7 +41,7 @@ ?S: is reused without questioning. ?S:. ?V:csym -?T:tval tx tlook tf tdc tc +?T:tval tx tlook tf tdc tc file : is a C symbol defined? csym='tlook=$1; case "$3" in @@ -49,6 +49,7 @@ case "$3" in -a) tf=libc.tmp; tc="[0]"; tdc="[]";; *) tlook="^$1\$"; tf=libc.list; tc=""; tdc="()";; esac; +file=csym.log; tx=yes; case "$reuseval-$4" in true-) ;; @@ -72,16 +73,28 @@ yes) ?X: type), the compiler assuming it's a built-in declaration given that the ?X: returned size matches. At least with 'char' we are safe! -- RAM, for ADO ?X: -?X: Let's thank GNU cc for making our lifes so easy! :-) +?X: Let's thank GNU cc for making our lives so easy! :-) ?X: (An alternative for the future would be to use our knowledge about gcc ?X: to force a -fno-builtin option in the compile test, in case the 'char' ?X: trick is obsoleted by future gcc releases). -- RAM ?X: -?X: Lastly, gcc 3.4 otimizes &missing == 0 away, so we use + 2 instead now. +?X: Lastly, gcc 3.4 optimizes &missing == 0 away, so we use + 2 instead now. ?X: The GNU folks like to do weird things, don't they? -- RAM, 2004-06-05 +?X +?X: The above was invalid because main returns an int not a pointer. +?X: Using != or == does not work because GCC complains the pointer will +?X: never be NULL if the function exists. It is a warning meant to prevent +?X: using an address of a function by accident instead of calling it. +?X: However, &missing > 0 is indeed silently optimized away. +?X +?X: FIXME: There must be a test whether non-existing functions are found! ?X: - echo "extern char $1$tdc; int main() { return &$1$tc + 2; }" > t.c; - if $cc $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1; +?X:. -- cbiere, 2011-01-18 +?X: + echo "--- $1$tdc ---" >> "$file"; + echo "extern char $1$tdc; int main(void) { return (unsigned long) &$1$tc > 2; }" > t.c; + $cat t.c >> "$file"; + if $cc $ccflags $ldflags -o t t.c $libs >>"$file" 2>&1; then tval=true; else tval=false; fi; @@ -93,5 +106,6 @@ yes) *) tval=false;; esac;; esac; +echo "==> HAS $1$tdc is $tval ($4)" >>"$file"; eval "$2=$tval"' |