Dear All,

Please remove my e-mail adress from your list

E-mail: [email protected]
Thanks,

E van den Boom
----- Original Message ----- From: "JMGross" <[email protected]>
To: "MSPGCC mailing list," <[email protected]>
Sent: Monday, January 25, 2010 1:27 PM
Subject: Re: [Mspgcc-users] Possible preprocessor bug




Hi!

After you telling me that it works as expected for you, I tried some more test cases. And yes, in your setup it works.
The difference is that the include file in question was placed differently.
If the included files are in the project folder, all works as expected.
If they are in the msp430/include folder, things do not work as expected. Or maybe they do, but not as _I_ expected.

try the following:
add the lines

#include "msp430x54xx.h"
#define WDTCTL_ 0
#ifdef WDTCTL_
#warning redefinition warning expected
#define WDTCTL_ 1
#endif

right at the start of your projects "msp430xyyy.h" file and compile.

On my machine it gives

---------------------
c:/Programme/msp430/mspgcc_0812/bin/msp430-gcc -v -c -std=gnu99 -g -Os -Wall -Wcast-align -Wcast-qual -Wimplicit -Wnested-externs -Wpointer-arith -Wredundant-decls -Wreturn-type -Wshadow -Wstrict- prototypes -Wswitch -Wunused -Wundef -Wunreachable-code -mmcu=msp430x5438 -Wa,-ahlms=obj/ez3.lst -I. -I../EPOS_COMMON_3 ez3.c -o obj/ez3.o Reading specs from c:\Programme\msp430\mspgcc_0812\bin\..\lib\gcc-lib\msp430\3.2.3\specs Configured with: ./configure --target=msp430 --prefix=c:/work/mspgcc/sf/packaging/build/installed --disable-multilib --disable-libc --disable-libssp --disable-intl --disable-libiberty --with-gcc --with-gnu-ld --with-gnu-as -- with-stabs --disable-shared --disable-threads --disable-win32-registry --disable-nls --enable-languages=c,c++
Thread model: single
gcc version 3.2.3
c:\Programme\msp430\mspgcc_0812\bin\..\lib\gcc-lib\msp430\3.2.3\cc1.exe -lang-c -v -I. -I../EPOS_COMMON_3 -iprefix c:/Programme/msp430/mspgcc_0812/bin/..\lib/gcc-lib/msp430\3.2.3\ -D__GNUC__=3 - D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=3 -D__GXX_ABI_VERSION=102 -DMSP430 -D__MSP430__ -D__MSP430 -D__OPTIMIZE_SIZE__ -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -DMSP430 _HAS_HW_MUL -D__MSP430_5438__ -D__MSP430X2__ -DMSP430_HAS_HWMUL -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -D__INT_MAX__=32767 ez3.c -quiet -dumpbase ez3.c - mmcu=msp430x5438 -g -Os -Wall -Wcast-align -Wcast-qual -Wimplicit -Wnested-externs -Wpointer-arith -Wredundant-decls -Wreturn-type -Wshadow -Wstrict-prototypes -Wswitch -Wunused -Wundef - Wunreachable-code -std=gnu99 -version -o C:\DOKUME~1\Grossi\LOKALE~1\Temp/ccuoFwwf.s
GNU CPP version 3.2.3 (cpplib) (GNU assembler syntax)
GNU C version 3.2.3 (msp430)
compiled by GNU C version 3.4.5 (mingw-vista special r3).
ignoring nonexistent directory "c:/Programme/msp430/mspgcc_0812/msp430/sys-include" ignoring nonexistent directory "c:/work/mspgcc/sf/packaging/build/installed/include" ignoring nonexistent directory "c:/work/mspgcc/sf/packaging/build/installed/lib/gcc-lib/msp430/3.2.3/include" ignoring nonexistent directory "c:/work/mspgcc/sf/packaging/build/installed/lib/gcc-lib/msp430/3.2.3/../../../../msp430/sys-include" ignoring nonexistent directory "c:/work/mspgcc/sf/packaging/build/installed/lib/gcc-lib/msp430/3.2.3/../../../../msp430/include"
#include "..." search starts here:
#include <...> search starts here:
.
../EPOS_COMMON_3
c:/Programme/msp430/mspgcc_0812/lib/gcc-lib/msp430/3.2.3/include
c:/Programme/msp430/mspgcc_0812/msp430/include
End of search list.
In file included from ../EPOS_COMMON_3/system54xx.h:27,
                from system.h:5,
                from ez3.c:11:
c:/Programme/msp430/mspgcc_0812/msp430/include/msp430x54xx.h:6:2: warning: #warning redefinition warning expected
c:\Programme\msp430\mspgcc_0812\bin\..\lib\gcc-lib\msp430\3.2.3\..\..\..\..\msp430\bin\as.exe 
--traditional-format -mmcu=msp430x5438 -ahlms=obj/ez3.lst -o 
obj/ez3.oC:\DOKUME~1\Grossi\LOKALE~1\Temp/ccuoFwwf.s    262      16       8     286     11e 
obj/ez3.o------------------------------you see, the manually placed warning is printed, but the 
redefinition is notdetected.It looks like the redefinition warning is suppressed when (msp)gcc 
includesa file from its global include path, but not when the included file is inthe project folder 
itself or one of the folders you added with the -Ioption.Since all global include files do an 
#undef before redefining things, I'mnot sure whether this is an intentional behaviour. And even if 
it is, itmakes working on the global include files more difficult - and a real painifyou're not 
aware of this.As a side effect I noticed that mspgcc does not add dependencies to globalinclude 
files into its generated dependency file, so if you change one ofthem, make will not remake the 
object files which include it. Onceagain, maybe intended (it definitely speeds up dependency 
checking) butstill a source of problems if you are working on the global includes.So question is: 
is there an option to disable this, at least as long as oneis working on the global includes.I just 
found a workaround: by manually adding the global include folder tothe search path (option 
-Ic:/Programme/msp430/mspgcc_0812/msp430/include),warnings do come as expected. And I got a couple 
morewarnings than expected.There are some more undiscovered redefinitions in theglobal includes: in 
string.h, memset is defined twice (identical), thestructured register declaration in wdt_a.h 
complains about a missingsemicolon and there was another double-definition in my 
ownunified_clock_system.h that slipped detection. All of them not harmful butstill undetected 
before.JMGross----- Ursprüngliche Nachricht -----Von: Przemek KlosowskiAn: 
[email protected] am: 22 Jan 2010 23:23:40Betreff: Re: [Mspgcc-users] Possible 
preprocessor bugJens-Michael,I didn't understand the problem. Perhaps you could explain it by 
providingan example of a minimal set of  .h files that demonstrate your problem byshowing what CPP 
gets vs. what you expected.I for instance made three files, a.h, b.h and c.h:a.h:#define WDTCTL0 
1b.h:#define WDTCTL0 2c,h:#include "a.h"#include "b.h"and my 3.2.3 mspgcc seems 
to do the right 
thing:[...]------------------------------------------------------------------------------Throughout 
its 18-year history, RSA Conference consistently attracts theworld's best and brightest in the 
field, creating opportunities forConferenceattendees to learn about information security's most 
important issuesthroughinteractions with peers, luminaries and emerging and established 
companies.http://p.sf.net/sfu/rsaconf-dev2dev_______________________________________________Mspgcc-users
 mailing 
[email protected]https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to