[aspectc-user] extern "C" parsing problem.
Guilherme .
guibufolo at gmail.com
Wed Apr 20 16:03:07 CEST 2011
Hi!
I have a header file "stdio.h" that has many lines in the format
__externC argument fn(params) __THROW;
__externC expands to extern "C" (as expected) and __THROW to throw() but on
some lines i get the message:
ecos/install/include/cyg/libc/stdio/stdio.h:155: error: invalid declaration
near token `"C"'
This is weird since for some lines there are no problem and on other it
complains...
Here is what i mean:
Excerpt from stdio.h
145 __externC FILE *
146 fopen( const char * /* filename */, const char * /* mode */ ) __THROW;
147
148 __externC FILE *
149 freopen( const char * /* filename */, const char * /* mode */,
150 FILE * /* stream */ ) __THROW;
151
152 __externC void
153 setbuf( FILE * /* stream */, char * /* buffer */ ) __THROW;
154
155 __externC int
156 setvbuf( FILE * /* stream */, char * /* buffer */, int /* mode */,
157 size_t /* size */ ) __THROW;
158
159
//========================================================================
160
161 // ISO C89 7.9.6 Formatted input/output functions
162
163 __externC int
164 fprintf( FILE * /* stream */, const char * /* format */, ... ) __THROW
165 CYGBLD_ATTRIB_PRINTF_FORMAT(2, 3);
166
167 __externC int
168 fscanf( FILE * /* stream */, const char * /* format */, ... ) __THROW
169 CYGBLD_ATTRIB_SCANF_FORMAT(2, 3);
170
171 __externC int
172 printf( const char * /* format */, ... ) __THROW
173 CYGBLD_ATTRIB_PRINTF_FORMAT(1, 2);
174
175 __externC int
176 scanf( const char * /* format */, ... ) __THROW
177 CYGBLD_ATTRIB_SCANF_FORMAT(1, 2);
178
179 __externC int
180 sprintf( char * /* str */, const char * /* format */, ... ) __THROW
181 CYGBLD_ATTRIB_PRINTF_FORMAT(2, 3);
182
183 __externC int
184 sscanf( const char * /* str */, const char * /* format */, ... ) __THROW
185 CYGBLD_ATTRIB_SCANF_FORMAT(2, 3);
186
187 __externC int
188 vfprintf( FILE * /* stream */, const char * /* format */,
189 va_list /* args */ ) __THROW CYGBLD_ATTRIB_PRINTF_FORMAT(2,
0);
190
and the error message from ac++:
ag++ -v9 --c_compiler i386-elf-g++ -o build/main.o main.cpp -c
-I./ecos/install/include -I.
-I/opt/sigubufo/branch/tools/gnutools/i386-elf/lib/gcc-lib/i386-elf/3.2.1/include/
-Wall -Wpointer-arith -Wstrict-prototypes -Wundef -Woverloaded-virtual
-Wno-write-strings -g -O2 -ffunction-sections -fdata-sections -fno-rtti
-fno-exceptions -D_KERNEL
*
*
* AG++ Configuration:
* Aspect C++ weaver: ac++
* C++ compiler: i386-elf-g++
* Files: main.cpp
* Options (G++): -v -o "build/main.o" -I "." -c -I
"./ecos/install/include" -I "." -I
"/opt/sigubufo/branch/tools/gnutools/i386-elf/lib/gcc-lib/i386-elf/3.2.1/include/"
-Wall -Wpointer-arith -Wstrict-prototypes -Wundef -Woverloaded-virtual
-Wno-write-strings -g -O2 -ffunction-sections -fdata-sections -fno-rtti
-fno-exceptions -D "_KERNEL"
* Options (AC++): -v9 -I "./ecos/install/include" -I "." -I
"/opt/sigubufo/branch/tools/gnutools/i386-elf/lib/gcc-lib/i386-elf/3.2.1/include/"
-D "_KERNEL" -p.
* Options (total): -v9 -v -o "build/main.o" main.cpp -I "." -c -I
"./ecos/install/include" -I "." -I
"/opt/sigubufo/branch/tools/gnutools/i386-elf/lib/gcc-lib/i386-elf/3.2.1/include/"
-Wall -Wpointer-arith -Wstrict-prototypes -Wundef -Woverloaded-virtual
-Wno-write-strings -g -O2 -ffunction-sections -fdata-sections -fno-rtti
-fno-exceptions -D "_KERNEL" -p.
* PumaConfig: 1 Weave: 1 Compile: 1 Link: 0
*
*
* Generating Puma configuration file
- Parsing output of g++ compiler
- Executing: "i386-elf-g++" -Wall -Wpointer-arith -Wstrict-prototypes
-Wundef -Woverloaded-virtual -Wno-write-strings -g -O2 -ffunction-sections
-fdata-sections -fno-rtti -fno-exceptions -E -dM -v -x c++ "/dev/null"
2>/tmp/agxx_stderrC5cftH 1>/tmp/agxx_stdoutEn4tHb
- Exit: Success
- removing temporary file: /tmp/agxx_stdoutEn4tHb
- removing temporary file: /tmp/agxx_stderrC5cftH
- Writing puma configuration file '/tmp/agxx_pcfg2cXLVF'
* Weaving
- Executing: "ac++" --config "/tmp/agxx_pcfg2cXLVF" -v9 -I
"./ecos/install/include" -I "." -I
"/opt/sigubufo/branch/tools/gnutools/i386-elf/lib/gcc-lib/i386-elf/3.2.1/include/"
-D "_KERNEL" -p. -c "main.cpp" -o "/tmp/main.cpp_agxx_2Dhk1d"
* Running ac++ 1.0
* Handling Translation Unit `main.cpp'.
- Path "main.cpp"
- Inserting namespace AC
- Parsing ...
ecos/install/include/cyg/libc/stdio/stdio.h:155: error: invalid declaration
near token `"C"'
ecos/install/include/cyg/libc/stdio/stdio.h:187: error: invalid declaration
near token `"C"'
ecos/install/include/cyg/libc/stdio/stdio.h:191: error: invalid declaration
near token `"C"'
ecos/install/include/cyg/libc/stdio/stdio.h:195: error: invalid declaration
near token `"C"'
ecos/install/include/cyg/libc/stdio/stdio.h:247: error: invalid declaration
near token `"C"'
as one can see he does only complain for some of the lines (until line 155
he is happy about all those __externC), not all...
Is there a way i can further narrow down this problem?
Best regards,
Guilherme
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20110420/fd9a5e2f/attachment.html>
More information about the aspectc-user
mailing list