[SOLVED] Identifying the chip at compile time

I am attempting to modify some code I created to take into account different register definitions for an attiny85. I found the following #ifdef in the tiny library so I thought this would work:

#if defined( __AVR_ATtinyX5__ )
  WDTCR |= _BV(WDCE) | _BV(WDE); // WDT control register, This sets the Watchdog Change Enable (WDCE) flag, which is  needed to set the 
  WDTCR = _BV(WDIE);             // Watchdog system reset (WDE) enable and the Watchdog interrupt enable (WDIE)
#else
  WDTCSR |= _BV(WDCE) | _BV(WDE);// WDT control register, This sets the Watchdog Change Enable (WDCE) flag, which is  needed to set the 
  WDTCSR = _BV(WDIE);            // Watchdog system reset (WDE) enable and the Watchdog interrupt enable (WDIE)
#endif

However, when I attempt to compile the library using the board="ATtiny85@8MHz (Internal oscillator. BOD disabled)" I get an error message : "home/wandrson/sketchbook/libraries/Entropy/Entropy.cpp:51:3: error: ‘WDTCSR’ was not declared in this scope" which seems to indicate that it is executing the else condition rather than the ATtiny code... I've searched and can't find a reference to what I should find defined for each of the AVR chips... Any suggestions on where I can find that information, or if something is wrong with my syntax above?

AVR_ATtinyX5 is defined by and specific to the Tiny Core...
http://code.google.com/p/arduino-tiny/source/browse/trunk/hardware/tiny/cores/tiny/core_build_options.h#97

core_build_options.h is also specific to the Tiny Core and disappears in the next version so I suggestion using this...

#if defined( __AVR_ATtiny25__ ) || defined( __AVR_ATtiny45__ ) || defined( __AVR_ATtiny85__ )

CodingBadly:

Thanks for the information. Could you give me a reference to where I could find what macros are defined for what processors, in case I incorporate other processor types. I've search the AVR-LIBC documentation and haven't found any information. Would prefer not to find and grep the source for the library.

wanderson:
Could you give me a reference to where I could find what macros are defined for what processors, in case I incorporate other processor types.

I'm not aware of such a reference. I do know that the pattern for the which-processor macro is always the same...

AVR_ATtiny45

Where...
"AVR" is always the prefix
"ATtiny45" is the exact model name from Atmel's documentation
"
_" is always the suffix

You will have to consult the datasheet(s) for which processors are in which families. There are no AVR_ATtinyX5 like macros available from AVR-GCC or Libc.

Or did I misunderstand. By "what macros are defined for what processors" do you also mean the "register macros"?

Would prefer not to find and grep the source for the library.

That's the route I've always taken.

Okay, thanks!