Skip to contentSkip to conversation

xenomai "does not" ISO C, C99 and C++ standard

Xenomai Victor Hiairrassary 2 participants 6 messages Apr 23, 2013 – Apr 28, 2013

lore
Share & tools
lore
#0 lore raw

Hello all,

We use xenomai 2.6.2.1 with g++ 4.7.2 from buildroot on a Armadeus apf27 board. This works really fine, but if we add "-W -Werror -Wall -pedantic -pedantic-errors" in compiler command line, g++ detects some warnings for a code as simple as :

#include <native/task.h>

int main() {
    return 0;
}

The complete log of the compilation is attached with this email.

The compiler complains about various things, in differents files. I have not tested other xenomai's headers like native/queue.h, etc. yet.

Do you have any plans to fix them?

Best regards,
Victor Hiairrassary
-------------- next part --------------
arm-g++ -o main.o -c main.cpp -W -Werror -Wall -pedantic -pedantic-errors -I sysroot/usr/include/xenomai/ -std=c++11 In file included from sysroot/usr/include/xenomai/nucleus/trace.h:52:0,
from sysroot/usr/include/xenomai/nucleus/system.h:27,
from sysroot/usr/include/xenomai/asm/xenomai/system.h:260,
from sysroot/usr/include/xenomai/nucleus/types.h:36,
from sysroot/usr/include/xenomai/nucleus/thread.h:25,
from sysroot/usr/include/xenomai/nucleus/sched.h:31,
from sysroot/usr/include/xenomai/native/task.h:25,
from main.cpp:1:
sysroot/usr/include/xenomai/asm/xenomai/syscall.h:108:34: error: ISO C does not permit named variadic macros [-Wvariadic-macros] sysroot/usr/include/xenomai/asm/xenomai/syscall.h:178:52: error: ISO C does not permit named variadic macros [-Wvariadic-macros] In file included from sysroot/usr/include/xenomai/nucleus/system.h:27:0,
from sysroot/usr/include/xenomai/asm/xenomai/system.h:260,
from sysroot/usr/include/xenomai/nucleus/types.h:36,
from sysroot/usr/include/xenomai/nucleus/thread.h:25,
from sysroot/usr/include/xenomai/nucleus/sched.h:31,
from sysroot/usr/include/xenomai/native/task.h:25,
from main.cpp:1:
sysroot/usr/include/xenomai/nucleus/trace.h:56:1: error: ISO C99 requires rest arguments to be used sysroot/usr/include/xenomai/nucleus/trace.h:61:1: error: ISO C99 requires rest arguments to be used sysroot/usr/include/xenomai/nucleus/trace.h:66:1: error: ISO C99 requires rest arguments to be used sysroot/usr/include/xenomai/nucleus/trace.h:71:1: error: ISO C99 requires rest arguments to be used sysroot/usr/include/xenomai/nucleus/trace.h:76:1: error: ISO C99 requires rest arguments to be used sysroot/usr/include/xenomai/nucleus/trace.h:82:1: error: ISO C99 requires rest arguments to be used sysroot/usr/include/xenomai/nucleus/trace.h:87:1: error: ISO C99 requires rest arguments to be used sysroot/usr/include/xenomai/nucleus/trace.h:94:1: error: ISO C99 requires rest arguments to be used
In file included from sysroot/usr/include/xenomai/nucleus/thread.h:25:0,
from sysroot/usr/include/xenomai/nucleus/sched.h:31,
from sysroot/usr/include/xenomai/native/task.h:25,
from main.cpp:1:
sysroot/usr/include/xenomai/nucleus/types.h:133:26: error: ISO C does not permit named variadic macros [-Wvariadic-macros] sysroot/usr/include/xenomai/nucleus/types.h:134:27: error: ISO C does not permit named variadic macros [-Wvariadic-macros] sysroot/usr/include/xenomai/nucleus/types.h:135:27: error: ISO C does not permit named variadic macros [-Wvariadic-macros] sysroot/usr/include/xenomai/nucleus/types.h:136:26: error: ISO C does not permit named variadic macros [-Wvariadic-macros] sysroot/usr/include/xenomai/nucleus/types.h:137:35: error: ISO C does not permit named variadic macros [-Wvariadic-macros] sysroot/usr/include/xenomai/nucleus/types.h:139:32: error: ISO C does not permit named variadic macros [-Wvariadic-macros] In file included from sysroot/usr/include/xenomai/nucleus/system.h:27:0,
from sysroot/usr/include/xenomai/asm/xenomai/system.h:260,
from sysroot/usr/include/xenomai/nucleus/types.h:36,
from sysroot/usr/include/xenomai/nucleus/thread.h:25,
from sysroot/usr/include/xenomai/nucleus/sched.h:31,
from sysroot/usr/include/xenomai/native/task.h:25,
from main.cpp:1:
sysroot/usr/include/xenomai/nucleus/trace.h: In function 'int xntrace_max_begin(long unsigned int)':
sysroot/usr/include/xenomai/nucleus/trace.h:56:9: error: ISO C++ forbids braced-groups within expressions [-pedantic] sysroot/usr/include/xenomai/nucleus/trace.h: In function 'int xntrace_max_end(long unsigned int)':
sysroot/usr/include/xenomai/nucleus/trace.h:61:9: error: ISO C++ forbids braced-groups within expressions [-pedantic] sysroot/usr/include/xenomai/nucleus/trace.h: In function 'int xntrace_max_reset()':
sysroot/usr/include/xenomai/nucleus/trace.h:66:9: error: ISO C++ forbids braced-groups within expressions [-pedantic] sysroot/usr/include/xenomai/nucleus/trace.h: In function 'int xntrace_user_start()':
sysroot/usr/include/xenomai/nucleus/trace.h:71:9: error: ISO C++ forbids braced-groups within expressions [-pedantic] sysroot/usr/include/xenomai/nucleus/trace.h: In function 'int xntrace_user_stop(long unsigned int)':
sysroot/usr/include/xenomai/nucleus/trace.h:76:9: error: ISO C++ forbids braced-groups within expressions [-pedantic] sysroot/usr/include/xenomai/nucleus/trace.h: In function 'int xntrace_user_freeze(long unsigned int, int)':
sysroot/usr/include/xenomai/nucleus/trace.h:81:9: error: ISO C++ forbids braced-groups within expressions [-pedantic] sysroot/usr/include/xenomai/nucleus/trace.h: In function 'int xntrace_special(unsigned char, long unsigned int)':
sysroot/usr/include/xenomai/nucleus/trace.h:87:9: error: ISO C++ forbids braced-groups within expressions [-pedantic] sysroot/usr/include/xenomai/nucleus/trace.h: In function 'int xntrace_special_u64(unsigned char, long long unsigned int)':
sysroot/usr/include/xenomai/nucleus/trace.h:92:9: error: ISO C++ forbids braced-groups within expressions [-pedantic]
make: *** [main.o] Error 1

#1 lore raw
Quoted 12 lines · Victor Hiairrassary

Hello all,

We use xenomai 2.6.2.1 with g++ 4.7.2 from buildroot on a Armadeus apf27 board. This works really fine, but if we add "-W -Werror -Wall -pedantic -pedantic-errors" in compiler command line, g++ detects some warnings for a code as simple as :

#include <native/task.h>

int main() {
     return 0;
}
Quoted 7 lines

The complete log of the compilation is attached with this email.

The compiler complains about various things, in differents files. I have not
tested other xenomai's headers like native/queue.h, etc. yet.

Do you have any plans to fix them?

What you could do to fix them is to move the functions implemented in trace.h to an src/skins/common/trace.c, this would allow to remove asm/xenomai/syscall.h from nucleus/trace.h, and would solve most of the warnings you are showing us. When you are done and it works for you, please submit a patch.

As for the variadic macros, I believe they exist in C99, so perhaps you are not compiling with the right flag, or perhaps we do not use the C99 syntax, which probably could be fixed too.

Signature · 1 line
                                                                Gilles.
#2 lore raw
Quoted 29 lines · Gilles Chanteperdrix
Quoted 12 lines · Victor Hiairrassary

Hello all,

We use xenomai 2.6.2.1 with g++ 4.7.2 from buildroot on a Armadeus apf27 board. This works really fine, but if we add "-W -Werror -Wall -pedantic -pedantic-errors" in compiler command line, g++ detects some warnings for a code as simple as :

#include <native/task.h>

int main() {
     return 0;
}
Quoted 7 lines

The complete log of the compilation is attached with this email.

The compiler complains about various things, in differents files. I have not
tested other xenomai's headers like native/queue.h, etc. yet.

Do you have any plans to fix them?

What you could do to fix them is to move the functions implemented in trace.h to an src/skins/common/trace.c, this would allow to remove asm/xenomai/syscall.h from nucleus/trace.h, and would solve most of the warnings you are showing us. When you are done and it works for you, please submit a patch.

Quoted 4 lines

As for the variadic macros, I believe they exist in C99, so perhaps you are not compiling with the right flag, or perhaps we do not use the C99 syntax, which probably could be fixed too.

It is a bit more complicated than that, removing asm/syscall.h from nucleus headers breaks __xn_rdtsc for instance. We will keep this change for later.

Signature · 1 line
                                                                Gilles.
#3 lore raw
In reply to Victor Hiairrassary
Quoted 12 lines · Victor Hiairrassary

Hello all,

We use xenomai 2.6.2.1 with g++ 4.7.2 from buildroot on a Armadeus apf27 board. This works really fine, but if we add "-W -Werror -Wall -pedantic -pedantic-errors" in compiler command line, g++ detects some warnings for a code as simple as :

#include <native/task.h>

int main() {
     return 0;
}
Quoted 7 lines

The complete log of the compilation is attached with this email.

The compiler complains about various things, in differents files. I have not
tested other xenomai's headers like native/queue.h, etc. yet.

Do you have any plans to fix them?

Hi Victor,

I have tried and fix this issue in Xenomai repository
(git://xenomai.org/xenomai-2.6.git), the errors disappeared completely for the native and posix skins headers in C. The modifications made to the posix headers for C do not seem to work for C++. It would be interesting if you could download and try it.

Without "-pedantic-errors", including posix headers in a C++ program simply triggers warning.

Regards.

Signature · 1 line
                                                                Gilles.
#5 lore raw
In reply to Victor Hiairrassary
Quoted 28 lines · Victor Hiairrassary
Quoted 8 lines · Gilles Chanteperdrix

Hi Victor,

I have tried and fix this issue in Xenomai repository
(git://xenomai.org/xenomai-2.6.git), the errors disappeared completely for the native and posix skins headers in C. The modifications made to the posix headers for C do not seem to work for C++. It would be interesting if you could download and try it.

Quoted 5 lines

Without "-pedantic-errors", including posix headers in a C++ program simply triggers warning.

Regards.

Hello,

I have tried with these settings (board apf27 : arm imx27):

xenomai_ver = f60f1a4f758a7d9b010f39f439eb98240b7beb42 xenomai_site = git://git.xenomai.org/xenomai-2.6.git
buildroot: 2013.02
gcc: 4.7.2
libc: eglibc 2_12
busybox: 1.21.0
U-Boot: custom (2012.04)
Linux: 2.6.38.8

Quoted 4 lines

I have tested a simple program (available in attached file compiler command lines and logs) in c90, c99, c++03 and c++11 standard.

Only c++11 have no warning !

You do not see the posix warnings because you are not compiling with posix skin flags (xeno-config --skin posix --cflags)
c99 does not work for you for the same reason (you are not using the flags provided by xeno-config).
I am not going to fix things more than that, I do not see why anyone would want to compile with old standards like c90 or c++03 Regards.

Signature · 1 line
                                                                Gilles.
#4 lore raw
In reply to Gilles Chanteperdrix
Quoted 8 lines · Gilles Chanteperdrix

Hi Victor,

I have tried and fix this issue in Xenomai repository
(git://xenomai.org/xenomai-2.6.git), the errors disappeared completely for the native and posix skins headers in C. The modifications made to the posix headers for C do not seem to work for C++. It would be interesting if you could download and try it.

Quoted 5 lines

Without "-pedantic-errors", including posix headers in a C++ program simply triggers warning.

Regards.

Hello,

I have tried with these settings (board apf27 : arm imx27):

xenomai_ver = f60f1a4f758a7d9b010f39f439eb98240b7beb42 xenomai_site = git://git.xenomai.org/xenomai-2.6.git
buildroot: 2013.02
gcc: 4.7.2
libc: eglibc 2_12
busybox: 1.21.0
U-Boot: custom (2012.04)
Linux: 2.6.38.8

I have tested a simple program (available in attached file compiler command lines and logs) in c90, c99, c++03 and c++11 standard.

Only c++11 have no warning !

Do not hesitate if you have other questions !

Best regards,
Victor Hiairrassary
-------------- next part --------------
#include <native/task.h>
#include <native/mutex.h>
#include <native/queue.h>
#include <native/event.h>
#include <native/alarm.h>
#include <native/buffer.h>
#include <native/pipe.h>
#include <native/cond.h>
#include <native/sem.h>
#include <native/intr.h>
#include <native/heap.h>

#include <time.h>
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <sys/mman.h>
#include <pthread.h>
#include <mqueue.h>
#include <posix/posix.h>

int main()
{
return 0;
}

- C : c90 : a lot of warnings
=======================

toolchain/bin/arm-linux-gcc main.c -I toolchain/include/xenomai -W -Wall -pedantic
In file included from toolchain/include/xenomai/asm/xenomai/atomic.h:26:0,

                from toolchain/include/xenomai/nucleus/system.h:26,
                from toolchain/include/xenomai/asm/xenomai/system.h:260,
                from toolchain/include/xenomai/nucleus/types.h:36,
                from toolchain/include/xenomai/nucleus/thread.h:25,
                from toolchain/include/xenomai/nucleus/sched.h:31,
                from toolchain/include/xenomai/native/task.h:25,
                from main.c:1:
toolchain/include/xenomai/asm/xenomai/features.h:151:1: warning: C++ style comments are not allowed in ISO C90 [enabled by default]
toolchain/include/xenomai/asm/xenomai/features.h:151:1: warning: (this will be reported only once per input file) [enabled by default]
In file included from toolchain/include/xenomai/nucleus/trace.h:52:0,
                from toolchain/include/xenomai/nucleus/system.h:27,
                from toolchain/include/xenomai/asm/xenomai/system.h:260,
                from toolchain/include/xenomai/nucleus/types.h:36,
                from toolchain/include/xenomai/nucleus/thread.h:25,
                from toolchain/include/xenomai/nucleus/sched.h:31,
                from toolchain/include/xenomai/native/task.h:25,
                from main.c:1:
toolchain/include/xenomai/asm-generic/xenomai/syscall.h:44:16: warning: ISO C90 does not support 'long long' [-Wlong-long]
In file included from toolchain/include/xenomai/nucleus/trace.h:53:0,
                from toolchain/include/xenomai/nucleus/system.h:27,
                from toolchain/include/xenomai/asm/xenomai/system.h:260,
                from toolchain/include/xenomai/nucleus/types.h:36,
                from toolchain/include/xenomai/nucleus/thread.h:25,
                from toolchain/include/xenomai/nucleus/sched.h:31,
                from toolchain/include/xenomai/native/task.h:25,
                from main.c:1:

toolchain/include/xenomai/asm/xenomai/tsc.h:37:25: warning: ISO C90 does not support 'long long' [-Wlong-long] toolchain/include/xenomai/asm/xenomai/tsc.h:43:23: warning: ISO C90 does not support 'long long' [-Wlong-long] toolchain/include/xenomai/asm/xenomai/tsc.h:51:29: warning: ISO C90 does not support 'long long' [-Wlong-long] In file included from toolchain/include/xenomai/nucleus/system.h:27:0,

                from toolchain/include/xenomai/asm/xenomai/system.h:260,
                from toolchain/include/xenomai/nucleus/types.h:36,
                from toolchain/include/xenomai/nucleus/thread.h:25,
                from toolchain/include/xenomai/nucleus/sched.h:31,
                from toolchain/include/xenomai/native/task.h:25,
                from main.c:1:
toolchain/include/xenomai/nucleus/trace.h:69:57: warning: ISO C90 does not support 'long long' [-Wlong-long]
In file included from toolchain/include/xenomai/nucleus/types.h:36:0,
                from toolchain/include/xenomai/nucleus/thread.h:25,
                from toolchain/include/xenomai/nucleus/sched.h:31,
                from toolchain/include/xenomai/native/task.h:25,
                from main.c:1:
toolchain/include/xenomai/asm/xenomai/system.h:267:1: warning: C++ style comments are not allowed in ISO C90 [enabled by default]
toolchain/include/xenomai/asm/xenomai/system.h:267:1: warning: (this will be reported only once per input file) [enabled by default]
In file included from toolchain/include/xenomai/nucleus/thread.h:25:0,
                from toolchain/include/xenomai/nucleus/sched.h:31,
                from toolchain/include/xenomai/native/task.h:25,
                from main.c:1:

toolchain/include/xenomai/nucleus/types.h:48:23: warning: ISO C90 does not support 'long long' [-Wlong-long] toolchain/include/xenomai/nucleus/types.h:50:14: warning: ISO C90 does not support 'long long' [-Wlong-long] toolchain/include/xenomai/nucleus/types.h:52:23: warning: ISO C90 does not support 'long long' [-Wlong-long] toolchain/include/xenomai/nucleus/types.h:54:14: warning: ISO C90 does not support 'long long' [-Wlong-long] toolchain/include/xenomai/nucleus/types.h:133:18: warning: anonymous variadic macros were introduced in C99 [-Wvariadic-macros] toolchain/include/xenomai/nucleus/types.h:134:19: warning: anonymous variadic macros were introduced in C99 [-Wvariadic-macros] toolchain/include/xenomai/nucleus/types.h:135:19: warning: anonymous variadic macros were introduced in C99 [-Wvariadic-macros] toolchain/include/xenomai/nucleus/types.h:136:18: warning: anonymous variadic macros were introduced in C99 [-Wvariadic-macros] toolchain/include/xenomai/nucleus/types.h:137:27: warning: anonymous variadic macros were introduced in C99 [-Wvariadic-macros] toolchain/include/xenomai/nucleus/types.h:139:21: warning: anonymous variadic macros were introduced in C99 [-Wvariadic-macros] In file included from toolchain/include/xenomai/nucleus/sched.h:31:0,

                from toolchain/include/xenomai/native/task.h:25,
                from main.c:1:
toolchain/include/xenomai/nucleus/thread.h:144:16: warning: ISO C90 does not support 'long long' [-Wlong-long]
toolchain/include/xenomai/nucleus/thread.h:146:16: warning: ISO C90 does not support 'long long' [-Wlong-long]
In file included from toolchain/include/xenomai/native/task.h:26:0,
                from main.c:1:

toolchain/include/xenomai/native/types.h:59:23: warning: ISO C90 does not support 'long long' [-Wlong-long] toolchain/include/xenomai/native/types.h:61:14: warning: ISO C90 does not support 'long long' [-Wlong-long]

- C : c99 :
===========

toolchain/bin/arm-linux-gcc main.c -I toolchain/include/xenomai -o m -W -Wall -pedantic -std=c99
In file included from main.c:1:0:
toolchain/include/xenomai/native/task.h:113:5: error: unknown type name 'caddr_t'
In file included from main.c:3:0:
toolchain/include/xenomai/native/queue.h:63:2: error: unknown type name 'caddr_t'
In file included from main.c:11:0:
toolchain/include/xenomai/native/heap.h:64:2: error: unknown type name 'caddr_t'

- C++ : c++03
=============

toolchain/bin/arm-linux-g++ main.c -I toolchain/include/xenomai -o m -W -Wall -pedantic
In file included from toolchain/include/xenomai/nucleus/thread.h:25:0,

                from toolchain/include/xenomai/nucleus/sched.h:31,
                from toolchain/include/xenomai/native/task.h:25,
                from main.c:1:

toolchain/include/xenomai/nucleus/types.h:133:18: warning: anonymous variadic macros were introduced in C99 [-Wvariadic-macros] toolchain/include/xenomai/nucleus/types.h:134:19: warning: anonymous variadic macros were introduced in C99 [-Wvariadic-macros] toolchain/include/xenomai/nucleus/types.h:135:19: warning: anonymous variadic macros were introduced in C99 [-Wvariadic-macros] toolchain/include/xenomai/nucleus/types.h:136:18: warning: anonymous variadic macros were introduced in C99 [-Wvariadic-macros] toolchain/include/xenomai/nucleus/types.h:137:27: warning: anonymous variadic macros were introduced in C99 [-Wvariadic-macros] toolchain/include/xenomai/nucleus/types.h:139:21: warning: anonymous variadic macros were introduced in C99 [-Wvariadic-macros] In file included from toolchain/include/xenomai/nucleus/trace.h:52:0,

                from toolchain/include/xenomai/nucleus/system.h:27,
                from toolchain/include/xenomai/asm/xenomai/system.h:260,
                from toolchain/include/xenomai/nucleus/types.h:36,
                from toolchain/include/xenomai/nucleus/thread.h:25,
                from toolchain/include/xenomai/nucleus/sched.h:31,
                from toolchain/include/xenomai/native/task.h:25,
                from main.c:1:
toolchain/include/xenomai/asm-generic/xenomai/syscall.h:44:2: warning: ISO C++ 1998 does not support 'long long' [-Wlong-long]
In file included from toolchain/include/xenomai/nucleus/trace.h:53:0,
                from toolchain/include/xenomai/nucleus/system.h:27,
                from toolchain/include/xenomai/asm/xenomai/system.h:260,
                from toolchain/include/xenomai/nucleus/types.h:36,
                from toolchain/include/xenomai/nucleus/thread.h:25,
                from toolchain/include/xenomai/nucleus/sched.h:31,
                from toolchain/include/xenomai/native/task.h:25,
                from main.c:1:

toolchain/include/xenomai/asm/xenomai/tsc.h:37:2: warning: ISO C++ 1998 does not support 'long long' [-Wlong-long] toolchain/include/xenomai/asm/xenomai/tsc.h:43:1: warning: ISO C++ 1998 does not support 'long long' [-Wlong-long] toolchain/include/xenomai/asm/xenomai/tsc.h:51:1: warning: ISO C++ 1998 does not support 'long long' [-Wlong-long] In file included from toolchain/include/xenomai/nucleus/system.h:27:0,

                from toolchain/include/xenomai/asm/xenomai/system.h:260,
                from toolchain/include/xenomai/nucleus/types.h:36,
                from toolchain/include/xenomai/nucleus/thread.h:25,
                from toolchain/include/xenomai/nucleus/sched.h:31,
                from toolchain/include/xenomai/native/task.h:25,
                from main.c:1:
toolchain/include/xenomai/nucleus/trace.h:69:43: warning: ISO C++ 1998 does not support 'long long' [-Wlong-long]
In file included from toolchain/include/xenomai/nucleus/thread.h:25:0,
                from toolchain/include/xenomai/nucleus/sched.h:31,
                from toolchain/include/xenomai/native/task.h:25,
                from main.c:1:

toolchain/include/xenomai/nucleus/types.h:48:1: warning: ISO C++ 1998 does not support 'long long' [-Wlong-long] toolchain/include/xenomai/nucleus/types.h:50:1: warning: ISO C++ 1998 does not support 'long long' [-Wlong-long] toolchain/include/xenomai/nucleus/types.h:52:1: warning: ISO C++ 1998 does not support 'long long' [-Wlong-long] toolchain/include/xenomai/nucleus/types.h:54:1: warning: ISO C++ 1998 does not support 'long long' [-Wlong-long] In file included from toolchain/include/xenomai/nucleus/sched.h:31:0,

                from toolchain/include/xenomai/native/task.h:25,
                from main.c:1:
toolchain/include/xenomai/nucleus/thread.h:144:2: warning: ISO C++ 1998 does not support 'long long' [-Wlong-long]
toolchain/include/xenomai/nucleus/thread.h:146:2: warning: ISO C++ 1998 does not support 'long long' [-Wlong-long]
In file included from toolchain/include/xenomai/native/task.h:26:0,
                from main.c:1:

toolchain/include/xenomai/native/types.h:59:1: warning: ISO C++ 1998 does not support 'long long' [-Wlong-long] toolchain/include/xenomai/native/types.h:61:1: warning: ISO C++ 1998 does not support 'long long' [-Wlong-long]

- C++ : c++11 :
===============
toolchain/bin/arm-linux-g++ main.c -I toolchain/include/xenomai -o m -W -Wall -pedantic -std=c++11

No error at all in c++11 :D