AH_VERBATIM missing 2nd arg (was: OS/2 and stdarg module)

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

 



* Bruno Haible wrote on Tue, Jul 04, 2006 at 06:55:08PM CEST:
> Eric Blake wrote:
> > Meanwhile, is it worth patching autoconf/lib/autoheader.m4 to complain when
> > $2 of AH_VERBATIM is empty, so this mistake is less likely to occur in the
> > future?
> 
> This would be welcome. Something like this (untested)?

>   #
>   # Quote for Perl '' strings, which are those used by Autoheader.
>   m4_define([AH_VERBATIM],
> ! [m4_ifval([$1],
> !    [AS_LITERAL_IF([$1],
> ! 	          [AH_OUTPUT([$1], AS_ESCAPE([[$2]], [\\'']))])],
> !    [AS_WARN([AH_VERBATIM invoked with only one argument])])
>   ])

Hmm.  Besides the typo (warn for empty $1 instead of $2), this warning
is for the developer, to be issued at 'autoconf' execution time, not
configure run time, so it should use m4_warning, or maybe even better
AC_WARNING.  But I wonder a bit whether some code makes use of this
"feature" that
   AH_VERBATIM([key], [some code])
   dnl ...
   AH_VERBATIM([key], []) # no code

happens to not output the code.  Thoughts?

Cheers,
Ralf

	* autoconf/lib/autoheader.m4 (AH_VERBATIM): Warn about empty
	second argument.  Reported by Eric Blake and Bruno Haible.

Index: lib/autoconf/autoheader.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/autoheader.m4,v
retrieving revision 1.7
diff -u -r1.7 autoheader.m4
--- lib/autoconf/autoheader.m4	14 May 2005 07:00:39 -0000	1.7
+++ lib/autoconf/autoheader.m4	6 Jul 2006 16:20:08 -0000
@@ -67,8 +67,10 @@
 #
 # Quote for Perl '' strings, which are those used by Autoheader.
 m4_define([AH_VERBATIM],
-[AS_LITERAL_IF([$1],
-	       [AH_OUTPUT([$1], AS_ESCAPE([[$2]], [\\'']))])
+[m4_ifval([$2],
+  [AS_LITERAL_IF([$1],
+	         [AH_OUTPUT([$1], AS_ESCAPE([[$2]], [\\'']))])],
+  [AC_WARNING([AH_VERBATIM invoked with only one argument])])
 ])
 
 


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux