[okl4-developer] Cannot use the C library with C++?
Tomas Hruby
thruby at cs.otago.ac.nz
Tue Oct 7 19:57:29 EST 2008
Hi,
> My observation is that SCONS even then stops on warnings when the
> '-Werror' option is removed from the GNU compiler command line. My guess
> is that SCONS stops whenever a build command returns non-0, and I think
> the GNU compiler returns different non-0 values for warnings and errors.
> So the task is to teach SCONS not to stop on the warnings return value
> given by the compiler, or to adjust the compiler's warnings generation,
> if possible for the given case.
I am getting heaps of warnings when compiling with a newer gcc than
the officially supported and -Wno-error works fine for me. It still
shows the warnings (actually, I don't want to get rid of them), but
the compilation does not fail.
T.
> An alternative to manipulate 'tools/toolchain.py' (which would change
> the builder options globally) is to change it in the SConscript file of
> application. For instance, the statement
> "env.scons_env["CC_WARNINGS"].remove('error')" would remove the
> '-Werror' from the current build environment.
>
> Regards
> Frank
> > -----Original Message-----
> > From: developer-bounces at okl4.org [mailto:developer-bounces at okl4.org]
> On Behalf
> > Of Tomas Hruby
> > Sent: Tuesday, October 07, 2008 9:58 AM
> > To: Alexandre Courbot
> > Cc: developer at okl4.org
> > Subject: Re: [okl4-developer] Cannot use the C library with C++?
> >
> > Hi Alex,
> >
> > On Tue, Oct 07, 2008 at 04:37:38PM +0900, Alexandre Courbot wrote:
> > > Hello everybody,
> > >
> > > I'm currently trying to port a C++ (well, C with classes actually)
> > > written root server to OKL4 2.1.1-patch9. My problem is that it
> looks
> > > like the C library does not like being parsed by the C++ compiler.
> > > Consider the following example:
> > >
> > > extern "C" {
> > > #include <stdio.h>
> > > }
> > >
> > > int main()
> > > {
> > > printf("Hello, world!\n");
> > > return 0;
> > > }
> > >
> > > After integrating it as a separate project and running the builder,
> I
> > obtain:
> > >
> > > $ ./tools/build.py machine=ia32_pc99 project=arc verbose_str=1
> > > scons: Reading SConscript files ...
> > > architecture ia32 is not yet supported by libcompat.
> > > architecture ia32 is not yet supported by libcompat.
> > > scons: done reading SConscript files.
> > > scons: Building targets ...
> > >
> /opt/okl/Linux-i386/stow/i686-unknown-linux-gnu/bin/i686-unknown-linux-g
> nu-
> > g++
> > > -Wall -Wredundant-decls -Wundef -Wpointer-arith -Wno-uninitialized
> > > -Werror -O2 -nostdlib -nostdinc -fno-builtin -g -fno-exceptions
> > > -fomit-frame-pointer -finline-limit=99999999 -DCONFIG_CPU_IA32_I686
> > > -DCONFIG_CPU_IA32_I686 -DARCH_IA32 -DMACHINE_IA32_PC99
> -DENDIAN_LITTLE
> > > -DWORDSIZE_32 -DKENGE_L4_ROOTSERVER -DCONFIG_MAX_THREAD_BITS=10
> > > -D__L4_ARCH__=ia32 -DL4_ARCH_IA32 -DCONFIG_USER_MUTEXES=1
> > > -DTHREAD_SAFE -Ibuild/l4_rootserver/include
> > > -Ibuild/l4_rootserver/object/arc/include arc/src/test2.cc -c -o
> > > build/l4_rootserver/arc/object/src/test2.o
> > > In file included from
> > build/l4_rootserver/include/atomic_ops/atomic_ops.h:218,
> > > from build/l4_rootserver/include/mutex/mutex.h:69,
> > > from build/l4_rootserver/include/stdio.h:75,
> > > from arc/src/test2.cc:2:
> > > build/l4_rootserver/include/atomic_ops/arch/atomic_ops.h: In
> function
> > > `okl4_atomic_plain_word_t
> > > okl4_atomic_dec_return(okl4_atomic_word_t*)':
> > > build/l4_rootserver/include/atomic_ops/arch/atomic_ops.h:324:
> warning:
> > > passing negative value `-0x000000001' for converting 2 of
> > > `okl4_atomic_plain_word_t
> okl4_atomic_add_return(okl4_atomic_word_t*,
> > > okl4_atomic_plain_word_t)'
> > > scons: *** [build/l4_rootserver/arc/object/src/test2.o] Error 1
> > > scons: building terminated because of errors.
> > >
> > > This is just a warning, but the builder does not let it go. Now if
> > > only I knew how to fix it or how to disable the -Werror flag of the
> > > compiler... :) Would someone have a pointer for this?
> >
> > You can tell gcc not to treat some warnings as errors using -Wno-error
> > option. -fdiagnostics-show-option tells you which one you need to turn
> > off. See man gcc for all the options. You could also remove the
> > -Werror option, search for CC_WARNINGS in tools/toolchains.py
> >
> > T.
> >
> > _______________________________________________
> > Developer mailing list
> > Developer at okl4.org
> > https://lists.okl4.org/mailman/listinfo/developer
>
More information about the Developer
mailing list