autoconf-patches
[Top][All Lists]
Advanced

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

Re: AC_DEFINE_UNQUOTED doc update


From: Ralf Wildenhues
Subject: Re: AC_DEFINE_UNQUOTED doc update
Date: Fri, 29 Apr 2005 17:53:40 +0200
User-agent: Mutt/1.4.1i

Hi Stepan,

Thank you for your quick reply.

* Stepan Kasal wrote on Fri, Apr 29, 2005 at 03:37:37PM CEST:
> 
> First, I took the liberty to commit this change immediately
*snip*
> This is an obvious mistake, and I think it was I who commited that.
> So it's fixed now.

Thanks,

> > I just don't understand the reason against telling users to quote every
> > argument at least once.
> 
> You have to make it "once", not "at least once".  Overquoting is also
> a popular source for problems.  Yes, we should tell them this.  The question
> is, at which level we tell them that they need not to quote everything?
>       AC_DEFINE([HAVE_LIBREADLINE], [1], ...
> I think we should tell them at some stage, it can save them some typing.

Is saving on typing the only reason?  Let's use short, unreadable
variable names!  :->

No, seriously, for one bugreport less I'd happily type lots of quotes.
My editor also makes reading them easy, YMMV though.

> As far as the other changes are concerned, let me comment on the example on
> your mail:
> 
> 1) foo='bla [[blubb]]'
> 
> I'd prefer this:
>       [foo='bla [blubb]']

OK, good, and agreed.

> The explanation is that you simply are not allowed to write ``naked'' shell
> code in configure.ac.  Every word you write is considered for expansion
> by m4.  And the quote characters are treated specially.

OK.

> So unless your shell code is simple, you should quote it by [ ].
> Again, what does ``simple'' mean here?

A definition (if possible) would be nice.  This is a guess of mine:

Simple text is text composed of the characters isprint(3) recognizes,
but not including brackets, comma, dollar, and words that constitute
defined macro names, m4 commands.  Within pure Autoconf we guarantee
macros to be all uppercase matching
  _?A[CST]_.*
and m4 commands all match
  m4_.*
in regex(7) notation.  Outside macros should follow the convention...

(Yes, official naming convention would be very nice, even with all given
history of mess, for new macros.)

> Shall we teach the users to quote all shell code which is outside of any
> macros?  I don't think so.

I tend to disagree slightly here.

> But perhaps we should tell them that they have
> to quote to get real [ ] pairs.

ACK.

> 2) foo='['
> 
> Yes, this cannot be done.  You have to do something like this:
> m4_changequote()
> foo='['
> m4_changequote([,])
> 
> Citing from the m4 manual:
>    There is no way in `m4' to quote a string containing an unmatched
>    left quote, except using `changequote' to change the current quotes.

OK.  This was me being stupid.  I'm sorry, and thanks for the nice
explanation.

> 3)
> > | AC_DEFINE_UNQUOTED([bar], ["$foo"], [bla])
> > | AC_DEFINE_UNQUOTED([bar], [["$foo"]], [bla])
> 
> I don't think you are right here.  The second argument is not expanded
> by m4, as foo is not a defined macro.
> 
> Just do
>    AC_DEFINE_UNQUOTED(bar, "$foo", [bla])
> 
> and be well.  (The last argument is a text which might potentially
> contain a comma, so it's a good habit to quote it.)

OK.  Now I get to go back to the bug report and find out what really
went wrong.  :-)

Thanks again,
Ralf




reply via email to

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