Subject: Re: Compiling NetBSD with another compiler.
To: None <tech-userlevel@netbsd.org>
From: Aleksey Cheusov <cheusov@tut.by>
List: tech-userlevel
Date: 10/13/2007 16:37:27
> On Sat, Oct 13, 2007 at 01:01:09PM +0300, Aleksey Cheusov wrote:
 >> Why non-portable way of doing this renaming is used instead of
 >> just using macro like
 >> 
 >>    #define func func_new

> What do you do about user code that #undef's func?
You can not do anything with USER's code.
What do you do if user make this?

#undef AF_INET
#define AF_INET <any_random_value>

I'm talking about system headers only.

> That is valid for a
> number of macro/function pairs (e.g. fgetc). What do you do about user
> defined structs with a field "func"? That's perfectly valid C and would
> break horrible depending on the include order of header files.
Ok. Good point.

> In short, there is *no* standard way to achieve this behaviour.
Ok. There is no 100% way...but there is more
pragmatical solution I think.

if we_use_GCC_or_PCC
  use gcc/pcc function renaming
elif define(USE_DEFINE_FOR_FUNCTION_RENAMING__I_KNOW_WHAT_I_DO)
  use things like #define stat stat_new
else
  #error "no way to make function renaming"
endif

-- 
Best regards, Aleksey Cheusov.