Hi Dmitry,
I have tried a small test program to test the CONCAT macro's. It seems
the macro does
not work if there is an underscore in the string i.e "1_2".
The error message for when you compile the program below is:
------------------------- error messages --------------------------
gcc test.c -o test.o
test.c:14: undefined type, found `1234567891'
test.c:14: illegal external declaration, missing `;' after `_2'
test.c:15: undefined type, found `ATTR_PRINTF_1'
test.c:15: illegal external declaration, missing `;' after `ATTR_LIST_1'
test.c:15: undefined type, found `ATTR_FORMAT_PRINTF_1'
test.c:15: illegal external declaration, missing `;' after
`ATTR_PRINTF_1'
cpp-precomp: warning: errors during smart preprocessing, retrying in
basic mode
test.c:14: parse error before numeric constant
As you can see, it borkes when it hits the underscore.
Apart from writing the strings in-line, is there another method to
fix/fudge this
to get it to compile?
Cheers,
Bernie
----------------------- test program -------------------------------
#include "string.h"
#define CONCAT2(a,b) a##b
#define CONCAT3(a,b,c) a##b##c
#define CONCAT4(a,b,c,d) a##b##c##d
#define STRINGX(s) #s
#define DEF_FORMAT_ATTRIBUTE(TYPE, VALUES) \
DEF_ATTR_TREE_LIST (CONCAT4 (ATTR_,TYPE,_,VALUES), ATTR_NULL, \
CONCAT2 (ATTR_,TYPE), CONCAT2 (ATTR_LIST_,VALUES)) \
DEF_ATTR_TREE_LIST (CONCAT4 (ATTR_FORMAT_,TYPE,_,VALUES),
ATTR_FORMAT, \
CONCAT4 (ATTR_,TYPE,_,VALUES), ATTR_NULL)
CONCAT4(123,456,789,1_2)
DEF_FORMAT_ATTRIBUTE(PRINTF,1_2);
main()
{
}
------------------------ end of test program
--------------------------------
On Wednesday, May 28, 2003, at 10:20 PM, Dmitry wrote:
a##b concantinates strings into one:
CONCAT2(a,_b)
will result
a_b
STRINGX(s) #s
stringifies 's':
STRINGX(abcd)
will result
"abcd"
So, the problem is that these macros do not work.
So, check if __STDC__ is defined in system includes or in params
passed to the
compiler.
~d
On Wednesday 28 May 2003 09:04, Bernard Mentink wrote:
Hi again Dmitry,
An update. I fetched the gcc-core-2.2.3 tarball again, and this time I
do have the symcat.h header file you talk of.
However I still get the same compile error.
I tried a full gcc-3.2.3 tarball, still the same error .........@^%$
I wonder if it is my host compiler?, gcc -v shows:
------------------
gcc -v
Reading specs from /usr/libexec/gcc/darwin/ppc/3.1/specs
Thread model: posix
Apple Computer, Inc. GCC version 1175, based on gcc version 3.1
20020420 (prerelease)
----------------------
I wonder if Apple have done some funnies with this version of gcc??
I have been having a look at the symcat.h file. It does some
"__STDC__"
specific defines i.e:
#ifndef SYM_CAT_H
#define SYM_CAT_H
#if defined (__STDC__) || defined (ALMOST_STDC) || defined
(HAVE_STRINGIZE)
#define CONCAT2(a,b) a##b
#define CONCAT3(a,b,c) a##b##c
#define CONCAT4(a,b,c,d) a##b##c##d
#define STRINGX(s) #s
#else
/* Note one should never pass extra whitespace to the CONCATn macros,
e.g. CONCAT2(foo, bar) because traditonal C will keep the space
between
the two labels instead of concatenating them. Instead, make sure
to
write CONCAT2(foo,bar). */
#define CONCAT2(a,b) a/**/b
#define CONCAT3(a,b,c) a/**/b/**/c
#define CONCAT4(a,b,c,d) a/**/b/**/c/**/d
#define STRINGX(s) "s"
#endif
----------------
I don't understand what a##b does or for that matter a/**/b, I tried
both by forcing one or the other, but still
the same error.
Any other suggestions.
Cheers,
Bernie
On Tuesday, May 27, 2003, at 12:10 AM, Dmitry wrote:
That's right.
On Saturday 24 May 2003 08:40, Bernard Mentink wrote:
Can you also confirm that I am copying correctly the msp430 specific
code into the tree?
I am using: cp -r gcc/gcc-3.3/gcc/* gcc-3.2.3/gcc/
I have no actually idea what's wrong. Probably some OS issues
(really,
I never
faced with such a problem)
Try to get _full_ gcc sources, then recompile.
Cheers,
~d
--
/********************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys
(_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 3468202, 5585314
********************************************************************/
-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
--
/********************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys
(_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 3468202, 5585314
********************************************************************/
-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users