- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am struggling with ICC that reports an error regarding stdlib.h
There is a couple of places where C++ style comments appear in this header.
Surprisingly, ICC refused to accept it. Here is the error I get:
/usr/include/stdlib.h(520): error: expected a declaration
// XXX There should be a macro to signal with C++ revision is used.
Looking at the file we see
#ifdef __USE_GNU
// XXX There should be a macro to signal with C++ revision is used.
// XXX This function is in the C++1x revision.
/* Register a function to be called when `quick_exit' is called. */
# ifdef __cplusplus
extern "C++" int at_quick_exit (void (*__func) (void))
__THROW __asm ("at_quick_exit") __nonnull ((1));
# else
extern int at_quick_exit (void (*__func) (void)) __THROW __nonnull ((1));
# endif
Isn't it a standard (now) / well accepted extension (before) ? Is it a bug in ICC?
Thank you.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Than you for your reply. Could you please report this error to the developers.
The testcase is very simple, please see the code below
[cpp]#includeint main (void) { return 0; } [/cpp]
When I compile the file with
icc -ansi dummy.c
I get no errors (which is probably wrong! but this is consistent with gcc)
When I compile it with
icc -ansi -D_GNU_SOURCE dummy.c
I get the aforementioned error (in contrast with gcc which detects no errors)
/usr/include/stdlib.h(520): error: expected a declaration
// XXX There should be a macro to signal with C++ revision is used.
^
/usr/include/stdlib.h(546): error: expected a declaration
// XXX There should be a macro to signal with C++ revision is used.
^
The file stdlib.h comes form the libc6-dev package (version 2.11.1-0ubuntu7.1) on Ubuntu 10.4.
I assume that -ansi flag should produce an error in this case, however, it is the combination -ansi -D_GNU_SOURSE that triggers icc.
P.S.
I am using ICC v. 11.1.072:
icc -V
Intel C Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20100414 Package ID: l_cproc_p_11.1.072
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.
FOR NON-COMMERCIAL USE ONLY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
~/LANG> grep -i '// *XXX' /usr/include/stdlib.h
~/LANG>
Could it be that the bug is specific to Ubuntu?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you explain what you are trying to achieve with GNU_SOURCE ? The option doesn't seem to be well documented, but (as far as I can tell) is intended to be set to support compilation of specific non-portable code intended for gcc only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The flags are set by MATLAB's mex complier (a shell script that creates a shared library from your sources). I am not sure they are vital. To resolve the issue with C++ comments I simply removed that '-ansi' flag from this script.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can compile the test case without any issue with icc.
$ icc tstcase.c
$ ./a.out
$ icc -V
Intel C Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20100203 Package ID: l_cproc_p_11.1.069
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.
$ uname -a
Linux maya11 2.6.29.4-167.fc11.x86_64 #1 SMP Wed May 27 17:27:08 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks,
Jidnya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
...
Hi,
Did you check the 'stdlib.h' header file forlines like these?
...
// XXX There should be a macro to signal with C++ revision is used.
// XXX This function is in the C++1x revision.
/* Register a function to be called when `quick_exit' is called. */
...
If you don't havecould add these three linesandcompile again? The compilation error looks like a bug in the compiler...
Best regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am unable to reproduce the issue. I am using VS2010.
c:\>type tstcase.c
// tstcase.c
#include
// XXX There should be a macro to signal with C++ revision is used.
// XXX This function is in the C++1x revision.
/* Register a function to be called when `quick_exit' is called. */
int
main(void) {
return 0;
}
c:\>icl tstcase.c
Intel C++ Intel 64 Compiler XE for applications running on Intel 64, Version 12.1.1.258 Build 20111011
Copyright (C) 1985-2011 Intel Corporation. All rights reserved.
tstcase.c
Microsoft Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
-out:tstcase.exe
tstcase.obj
Did I miss something?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
...
#include
// XXX There should be a macro to signal with C++ revision is used.
// XXX This function is in the C++1x revision.
/* Register a function to be called when `quick_exit' is called. */
...
Did I miss something?
No. Thanks for the test.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page