Heyda Bernhard and All!

On Tuesday 05 August 2008 18:18:03 Bernhard Fischer wrote:
> On Tue, Aug 05, 2008 at 03:11:29PM +0200, Yann E. MORIN wrote:
> >So I do not know where this '__typeof' comes from, but we'd be better using
> >'__typeof__' instead, no?
> I was just about to apply it blindly (don't remember if you have
> write-access), but you seem to be setup to actually test it :)

No I don't have write access. I'm not comfortable with having it, anyway.

> find ./ \( -name "*.[ch]" -o -name "*.inc" \) -exec \
> sed -i -e "/typeof[[:space:]]*(/s/[_]*typeof[_]*/__typeof__/;" {} \;

That's not the only problem. We also use 'asm' statements, but we explicitly
instruct the compiler not to recognize them, in Rules.mak, around line 466:

$ svn blame Rules.mak
[--SNIP--
| 22868      aldot # Make sure that we can be built with non-C99 compilers, too.
| 22868      aldot # Use __\1__ instead.
| 22868      aldot CFLAGS += $(call check_gcc,-fno-asm,)

The change is really recent:
$ svn log -r 22868
------------------------------------------------------------------------
r22868 | aldot | 2008-07-17 18:54:31 +0200 (Thu, 17 Jul 2008) | 4 lines

- poison non-standard keywords:
  Make sure that we can be built with non-C99 compilers, too.
  Use __\1__ instead.
------------------------------------------------------------------------

Hmmm. Who's 'aldot', by the way? I can't seem to remember... ;-) Hehe!

We should audit the code for other keywords that ought to be replaced
with __\1__. We should also provide macros for those when we're not
using gcc. x86_64 bombed on me in libc/sysdeps/linux/x86_64/sigaction.c
at line 147:

[--SNIP--]
| #define RESTORE(name, syscall) RESTORE2 (name, syscall)
| # define RESTORE2(name, syscall) \
| asm                                             \
|   (                                             \
|    ".text\n" \
|    "__" #name ":\n"                             \
|    "    movq $" #syscall ", %rax\n"             \
|    "    syscall\n"                              \
|    );
| #ifdef __NR_rt_sigaction
| /* The return code for realtime-signals.  */
| RESTORE (restore_rt, __NR_rt_sigreturn)
| #endif
| #ifdef __NR_sigreturn
| RESTORE (restore, __NR_sigreturn)
| #endif

Which expands to something like (with my .config):
| # 147 "libc/sysdeps/linux/x86_64/sigaction.c"
| asm ( ".text\n" "__" "restore_rt" ":\n" "       movq $" "15" ", %rax\n" "     
  syscall\n" );

But the command line contains both '-fno-asm' and '-std=gnu99' (-save-temps
is from me!):
| ../gcc-core-static/bin/x86_64-unknown-linux-uclibc-gcc -save-temps
| -c libc/sysdeps/linux/x86_64/sigaction.c
| -o libc/sysdeps/linux/x86_64/sigaction.os
| -include ./include/libc-symbols.h -Wall -pipe -Wstrict-prototypes
| -fno-strict-aliasing -fno-stack-protector -fno-builtin -nostdinc
| -I./include -I. -I./libc/sysdeps/linux/x86_64 -fno-asm -DUCLIBC_INTERNAL
                                        Here ----'
| -std=gnu99 -Os -funit-at-a-time -fno-tree-loop-optimize
    '---- and here
| -fno-tree-dominator-opts -fno-strength-reduce
| -I./libpthread/linuxthreads.old/sysdeps/unix/sysv/linux/x86_64
| -I./libpthread/linuxthreads.old/sysdeps/x86_64
| -I./libpthread/linuxthreads.old/sysdeps/unix/sysv/linux
| -I./libpthread/linuxthreads.old/sysdeps/pthread
| -I./libpthread/linuxthreads.old -I./libpthread
| 
-I/home/ymorin/x-tools/x86_64-unknown-linux-uclibc/x86_64-unknown-linux-uclibc/sys-root/usr/include/
| 
-I/home/ymorin/dev/crosstool-NG/ct-ng.trunk/targets/x86_64-unknown-linux-uclibc/build/gcc-core-static/lib/gcc/x86_64-unknown-linux-uclibc/4.3.1//include-fixed
| 
-I/home/ymorin/dev/crosstool-NG/ct-ng.trunk/targets/x86_64-unknown-linux-uclibc/build/gcc-core-static/lib/gcc/x86_64-unknown-linux-uclibc/4.3.1/include
| -DNDEBUG -fPIC -MT libc/sysdeps/linux/x86_64/sigaction.os -MD -MP
| -MF libc/sysdeps/linux/x86_64/.sigaction.os.dep

>From the gcc manual, we need to protect 'asm', 'inline', 'typeof', and
'restrict' (do we use the latest?) and use the alternate forms __\1__.

> I didn't look if comments would trigger, those should be omitted from
> what gets applied.

OK, let me try... Will come back later with a patch.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN     |   ^                |
| --==< °_° >==-- °------------.-------:  X  AGAINST      |  /e\  There is no  |
| http://ymorin.is-a-geek.org/ | * _ * | / \ HTML MAIL    |  """  conspiracy.  |
°------------------------------°-------°------------------°--------------------°

_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://busybox.net/cgi-bin/mailman/listinfo/uclibc

Reply via email to