Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
To: Ian Lance Taylor <iant@google.com>, bug-autoconf@gnu.org
Cc: Paolo Bonzini <bonzini@gnu.org>,
	binutils@sourceware.org,	gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix PR bootstrap/42798
Date: Mon, 07 Jun 2010 20:24:00 -0000	[thread overview]
Message-ID: <20100607202412.GB30591@gmx.de> (raw)
In-Reply-To: <mcry6er548s.fsf@dhcp-172-17-9-151.mtv.corp.google.com>

[ adding bug-autoconf ]

* Ian Lance Taylor wrote on Mon, Jun 07, 2010 at 04:03:47PM CEST:
> Ralf Wildenhues writes:
> > * Ian Lance Taylor wrote on Sun, Jun 06, 2010 at 11:42:13PM CEST:
> >
> >> My question about a basename declaration in the system header was a
> >> genuine question.  My concern is that on some systems this patch might
> >> decide incorrectly whether or not basename is defined, which could
> >> then possibly lead to a compilation error when libiberty.h is
> >> included.
> >
> > This concern should be addressed with my reply
> > <http://sourceware.org/ml/binutils/2010-06/msg00059.html>:
> > In short, the Autoconf change is designed to handle exactly this case
> > right both in C and in C++ mode.
> 
> That doesn't really address my concern.  That shows that autoconf will
> get a workable answer if I use only C++.  But there is only one
> config.h file.  gold has both .c and .cc files (the .c files are used
> via AC_REPLACE_FUNCS).  It's not obvious to me that a version of
> HAVE_DECL_BASENAME for C++ will necessarily work when compiling C.

OK, fair point.  The current Autoconf solution for AC_CHECK_DECLS
assumes that the developer either uses the answer for the compiler
language tested only, or that the answer is consistent between the
C and the C++ compiler.

When we find a case where this assumption does not hold, we can still
work with the current framework by using AC_CHECK_DECL (without 'S')
and setting per-language defines, e.g.:

  AC_LANG_PUSH([C])
  AC_CHECK_DECLS([basename]) dnl defines HAVE_DECL_BASENAME
  AC_LANG_POP([C])

  AC_LANG_PUSH([C++])
  AC_CHECK_DECL([basename(char *)],
                [AC_DEFINE([HAVE_DECL_BASENAME_CXX], [1],
                           [Define to 1 if you have a C++ declaration ]dnl
                           [of `basename(char *)'])])
  AC_LANG_POP([C++])

and then go from there.

But I don't think we need to go there unless we find a system that
warrants this.  Autoconf is assuming similar in a number of cases
already: With AC_C_RESTRICT, it first tries a spelling of restrict
that is likely to work with both C++ and C compilers, but only the
C compiler is tested (and when you mix compilers from different
vendors, such as GNU and Solaris, this is a problem).

Cheers,
Ralf


      reply	other threads:[~2010-06-07 20:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20100601204405.GA1170@gmx.de>
     [not found] ` <AANLkTim4-8VpK907cHTIcT2ELeZEgOBpLf0FUJmpPCJN@mail.gmail.com>
     [not found]   ` <20100602111845.GA16161@ins.uni-bonn.de>
     [not found]     ` <4C064B77.3020207@gnu.org>
2010-06-03  6:33       ` Ralf Wildenhues
2010-06-03  6:59         ` Ralf Wildenhues
2010-06-04 14:59           ` Ian Lance Taylor
2010-06-04 15:04             ` Paolo Bonzini
2010-06-04 18:44               ` Ralf Wildenhues
2010-06-06 11:28             ` Ralf Wildenhues
2010-06-06 21:42               ` Ian Lance Taylor
2010-06-07  6:11                 ` Ralf Wildenhues
2010-06-07 14:04                   ` Ian Lance Taylor
2010-06-07 20:24                     ` Ralf Wildenhues [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100607202412.GB30591@gmx.de \
    --to=ralf.wildenhues@gmx.de \
    --cc=binutils@sourceware.org \
    --cc=bonzini@gnu.org \
    --cc=bug-autoconf@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=iant@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox