autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch for C preprocessor supporting __func__ or __FUNCTION__


From: R. Bernstein
Subject: Re: Patch for C preprocessor supporting __func__ or __FUNCTION__
Date: Tue, 19 Nov 2002 00:27:16 -0500

Steven G. Johnson writes:
 > Note that __func__ is an identifier defined by the C compiler; it is not 
 > a macro according to the standard, and therefore has nothing to do with 
 > the C preprocessor.

That's perhaps overstating things a bit. It *may* be the case that
__func__ is not handled by a particular C preprocessor.  I just tried
on gcc 3.2 and __func__ isn't touched by the CPP, gcc's C
preprocessor. It is not clear whether __func__ or __FUNCTION__ has to
act that way though. And the way this patch implements __func__ if the
compiler doesn't support it, definitely uses the C preprocessor. :-)

But I'll agree with you largely and admit we may want to blur the
implementation in favor of how the user thinks of the source concept;
I'll also admit that we may want encourage users in accord with C99
thinking, not think of this as a C Preprocessor thing, even though
there may be and may have been C Preprocessor implementations (and
therefore thought of and acted that way).

 > 
 > There is an AC_C_VAR_FUNC in the autoconf macro repository.  I suggest 
 > that you coordinate with the author of this macro before submitting a patch.


Actually, I sort of have the same frustration. I actually first
submitted this mid July for autoconf 2.5.3 which I think predates
AC_C_VAR_FUNC. It's a pity when AC_C_VAR_FUNC went in the notion of
that it might also deal with __func__/__FUNCTION__, if AC_C_VAR_FUNC
could handle it, was not raised.  Whether or not this patch was taken,
it's a pity nothing was done on the issue itself, let alone
communicate with me about the matter until I noticed that there was a
new release and nothing was done, asked, and resent the patch.

But hey, life is that way. 

- - - -


From: Paul Eggert <address@hidden>
To: address@hidden
Cc: address@hidden
Subject: Re: Feature: C preprocessor supports __func__ or __FUNCTION__?
Date: Sun, 14 Jul 2002 02:34:48 -0700 (PDT)

> From: "R. Bernstein" <address@hidden>
> Date: Sat, 13 Jul 2002 20:58:07 -0400
> 
> Correct me if I am wrong, but it doesn't look like there is a macro
> that can be used to test if the C preprocessor __func__ or
> __FUNCTION__ "variables" work.

Correct.

> I'd imagine such a test would produce in config.h
> 
> #define __func__ __FUNCTION__ 
>
> if only __FUNCTION__ works, or nothing if __func__ works or 
> 
> #define __func__ "" 
> 
> if neither works.

Sounds reasonable.

> should I try to supply
> a patch to provide such a feature?

Sure!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]