[Lldb-commits] [lldb] r124892 - in /lldb/trunk: include/lldb/Host/Config.h include/lldb/Host/freebsd/ include/lldb/Host/freebsd/Config.h include/lldb/Host/linux/ include/lldb/Host/linux/Config.h include/lldb/Host/macosx/ include/lldb/Host/macosx/Config.h include/lldb/Host/mingw/ include/lldb/Host/mingw/Config.h lldb.xcodeproj/project.pbxproj

Stephen Wilson wilsons at start.ca
Fri Feb 4 15:10:07 PST 2011


Greg Clayton <gclayton at apple.com> writes:

> My one complaint with the not defining something if it is not
> available, is if you have an IDE that can take you to the definition
> of a #define, then it takes you nowhere when it isn't defined.
>
> If it is defined to zero, the it will be defined, and your IDE can
> take you to the place in the Config.h that has it set to zero,
> possibly with an explanation of why it is set to zero for this current
> build. I know IDEs have find in all files too, but that kicks up all
> the matches, not the one that you actually care about.
>
> I know this is a little different than the way things are done now,
> but I do like this approach a bit better.
>
> Does that make sense to everyone? Comments? Likes? Dislikes?

Main issue for me is that for config.h to be useful it must be (in
general) automatically generated via a configure stage or similar.  The
two main tools which enable this are autoconf and cmake, both of which
use the "define if available" convention.  

If we follow a different convention then we will not be able to use many
of the cmake functions and autoconf macros which are already written to
follow the existing conventions.  We would need to write our own (see
the AX_CHECK_* macros in the autoconf archive for lots of examples).

I would also be concerned with writing "#if !defined(FOO)" out of years
of habit, potentially introducing bugs as a result.

In short, I think there are problems with tool/brain compatibility when
adopting a convention other than the de facto standard -- effectively
making "config.h" itself less portable ;)

Take care,

> I am open to going either way. I just want to bring it up for discussion.
>
> Greg Clayton
>
>
> On Feb 4, 2011, at 12:38 PM, Stephen Wilson wrote:
>
>> 
>> Hi Greg,
>> 
>> Greg Clayton <gclayton at apple.com> writes:
>>> Added the start of platform configuration designed for internal LLDB use. 
>>> Internal use means for compiling the LLDB debug engine and plug-ins, but it
>>> should never make it into the public API.
>> 
>> This is great!
>> 
>>> Since we don't currently have a configuration script that detects avaiable
>>> functionality in the LLDB build system, we are hard coding #define values
>>> in the host specific "Config.h" files. 
>>> 
>>> #define values in these Config.h header files should set the value to zero or
>>> one:
>>> 
>>> #define LLDB_CONFIG_TERMIOS_SUPPORTED 1
>>> 
>>> #define LLDB_CONFIG_OTHER 0
>> 
>> Hmmm.  This goes against the well established practice of #define'ing
>> things IFF they are available:
>> 
>> 
>> #if defined(HAVE_TERMIOS)
>>   ...
>> #else
>>   ...
>> #endif
>> 
>> 
>> It would be great to have a configure script available for LLDB.
>> Adhering to the established practice would make things much easier if we
>> were to generate a configure script and config.h headers using tools
>> like autoconf.
>> 
>> 
>> --
>> steve
>

--
steve



More information about the lldb-commits mailing list