autoconf-patches
[Top][All Lists]
Advanced

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

RE: 10-forbidden-tokens-in-comments.patch


From: Bernard Dautrevaux
Subject: RE: 10-forbidden-tokens-in-comments.patch
Date: Thu, 18 Jan 2001 09:50:43 +0100

I'm not sure I agree with that patch; it's arguable to detect all
"\<_?A[AZ]_[A-Za-z0-9_]*" patterns in the configure code, but checking these
even in comments will be a *huge* burden for migration to the new autoconf. 

I would in fact favor a patch that will accept inconditionnaly these
macro-looking identifiers not only in comments, but also in strings, so that
I can have an

        AC_MSG_WARNING([Beware that AF_DECNET was not a valid domain on this
machine])

somewhere in my tests, without having to do special hacking with
m4_i_dont_know_what(AF_DECNET)... Clearly (although it's not very useful in
a distributed package) I could even add AC_MSG_WARNINGs about some
AC_SOMETHING macro that I would like to eliminate but want for a while to
just be warned if it is still called (I say called, not used, intentionally:
the macro may be used, but protected by a test that finally decide never to
call it).

The problem raised in another message about AF_INET used in C code is a bit
more complicated, as I may want to obtain C code by expansion of some
autoconf macro, and then detection of unexpanded macro is intersting there.
I just think that reserving all A[A-Z] digrams is a lot too picky; the
example of AF_xxxx is a good example: there is litterally tens of these cpp
macros out there starting by AF_ (and AI_), so using an autotool macro
starting by AF_ is at least dubious and surely will cause problems.... So we
should probably try to define which Ax_ digrams are ALLOWED to de
AC_DEFUN'ed rather that forbidding use of ANY Ax_starting macro.

And forgive me, but looking for all such macro-like-references and changing
the "_" by "-" to avoid the autoconf warning is a lot too hacky to be
satisfying :-)

Regards,

        Bernard

--------------------------------------------
Bernard Dautrevaux
Microprocess Ingenierie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel:    +33 (0) 1 47 68 80 80
Fax:    +33 (0) 1 47 88 97 85
e-mail: address@hidden
                address@hidden
-------------------------------------------- 

> -----Original Message-----
> From: Akim Demaille [mailto:address@hidden
> Sent: Thursday, January 18, 2001 1:03 AM
> To: APatche
> Subject: 10-forbidden-tokens-in-comments.patch
> 
> 
> Index: ChangeLog
> from  Akim Demaille  <address@hidden>
>       
>       * autoconf.sh (finalize.awk): Don't discard comments 
> when looking
>       for unexpanded tokens.
>       Adjust Autoconf and its test suite.
>       
> Index: acgeneral.m4
> --- acgeneral.m4 Wed, 17 Jan 2001 23:28:58 +0100 akim 
> (ace/27_acgeneral. 1.169.8.117 644)
> +++ acgeneral.m4 Wed, 17 Jan 2001 23:53:42 +0100 akim 
> (ace/27_acgeneral. 1.169.8.117 644)
> @@ -804,10 +804,8 @@ m4_define([_AC_INIT_DEFAULTS],
>  ac_tr_cpp="sed y%*$ac_cr_az%P$ac_cr_AZ%;s%[[^_$ac_cr_alnum]]%_%g"
>  
>  # By default always use an empty string as the executable extension.
> -# Only change it if the script calls AC_EXEEXT.
>  ac_exeext=
> -# By default assume that objects files use an extension of .o.  Only
> -# change it if the script calls AC_OBJEXT.
> +# By default assume that objects files use an extension of .o.
>  ac_objext=o
>  
>  m4_divert_pop([DEFAULTS])dnl
> @@ -4178,9 +4176,6 @@ m4_define([_AC_OUTPUT_FILES],
>    configure_input="Generated automatically from `echo $ac_file_in |
>                                                   sed 
> 's,.*/,,'` by configure."
>  
> -  # Don't redirect the output to AC_FILE directly: use `mv' so that
> -  # updating is atomic, and doesn't need trapping.
> -
>    # First look for the input files in the build tree, 
> otherwise in the
>    # src tree.
>    ac_file_inputs=`IFS=:
> @@ -4383,7 +4378,7 @@ m4_define([_AC_OUTPUT_HEADERS],
>  EOF
>  # If some macros were called several times there might be 
> several times
>  # the same #defines, which is useless.  Nevertheless, we may 
> not want to
> -# sort them, since we want the *last* AC_DEFINE to be honored.
> +# sort them, since we want the *last* AC-DEFINE to be honored.
>  uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
>  sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
>  rm -f confdef2sed.sed
> Index: aclang.m4
> --- aclang.m4 Wed, 17 Jan 2001 21:51:05 +0100 akim 
> (ace/b/32_aclang.m4 1.5.3.70 644)
> +++ aclang.m4 Thu, 18 Jan 2001 00:07:13 +0100 akim 
> (ace/b/32_aclang.m4 1.5.3.70 644)
> @@ -621,7 +621,7 @@ m4_define([AC_LINK_IFELSE],
>  [AC_FATAL([All the tests involving linking were disabled by $0])])
>  
>  m4_divert_pop()dnl
> -])# # AC_NO_EXECUTABLES
> +])# AC_NO_EXECUTABLES
>  
>  
>  
> @@ -1253,9 +1253,8 @@ AC_DEFUN([AC_PROG_F77_C_O],
>  AC_CACHE_CHECK([whether $F77 understand -c and -o together],
>                 [ac_cv_prog_f77_c_o],
>  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
> -# We do the `AC_TRY_EVAL' test twice because some compilers refuse to
> -# overwrite an existing `.o' file with `-o', although they 
> will create
> -# one.
> +# We test twice because some compilers refuse to overwrite 
> an existing
> +# `.o' file with `-o', although they will create one.
>  ac_try='$F77 $FFLAGS -c conftest.$ac_ext -o 
> conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
>  if AC_TRY_EVAL(ac_try) &&
>       test -f conftest.$ac_objext &&
> @@ -1362,12 +1361,10 @@ AC_DEFUN([AC_PROG_CC_STDC],
>  ])# AC_PROG_CC_STDC
>  
>  
> -
> -
> -
> -
> -AC_DEFUN([AC_C_CROSS],
> -[AC_OBSOLETE([$0], [; it has been merged into AC_PROG_CC])])
> +# AC_C_CROSS
> +# ----------
> +# Has been merged into AC_PROG_CC.
> +AU_DEFUN([AC_C_CROSS], [])
>  
>  
>  # AC_C_CHAR_UNSIGNED
> Index: autoconf.sh
> --- autoconf.sh Sat, 13 Jan 2001 11:47:33 +0100 akim 
> (ace/17_autoconf.s 1.31.8.40 666)
> +++ autoconf.sh Wed, 17 Jan 2001 23:38:31 +0100 akim 
> (ace/17_autoconf.s 1.31.8.40 666)
> @@ -381,9 +381,6 @@
>  
>        print
>  
> -      # Dubious feature: we tolerate macro names when commented.
> -      sub (/#.*/, "")
> -
>        # Get the tokens.
>        split (\$0, tokens, /[^$WORDCHAR]*/)
>  
> @@ -401,6 +398,11 @@
>      END {
>        if (some_macros_were_not_expanded)
>          {
> +       errprint("$me: some forbidden tokens, most probably 
> unexpanded macros,")
> +       errprint("$me: were found in the output and are 
> listed below.")
> +       errprint("$me: they might just appear in comments, 
> they should not.")
> +       errprint("$me: we suggest that you fix these issues, 
> but the output")
> +       errprint("$me: *has* been produced: use at your own risks.")
>            line = 0
>            while (getline < "$infile")
>              {
> Index: configure.in
> --- configure.in Sat, 13 Jan 2001 11:47:33 +0100 akim 
> (ace/7_configure. 1.29 664)
> +++ configure.in Wed, 17 Jan 2001 23:49:24 +0100 akim 
> (ace/7_configure. 1.29 664)
> @@ -17,7 +17,7 @@
>    AC_MSG_ERROR([GNU m4 1.4 is required])
>  fi
>  # This is needed because Automake does not seem to realize there is
> -# an AC_SUBST inside AC_PROG_GNU_M4.  Grmph!
> +# a AC-SUBST inside AC-PROG-GNU-M4.  Grmph!
>  AC_SUBST(M4)
>  
>  # `autoconf' and `ifnames' use AWK.
> Index: tests/semantics.at
> --- tests/semantics.at Wed, 17 Jan 2001 18:57:24 +0100 akim 
> (ace/b/25_semantics. 1.34 644)
> +++ tests/semantics.at Thu, 18 Jan 2001 00:11:11 +0100 akim 
> (ace/b/25_semantics. 1.34 644)
> @@ -179,14 +179,14 @@
>  # FIXME: To really test HAVE_AC_EXISTS2 and HAVE_AC_MISSING2 
> we need to
>  # open AH_TEMPLATE to `configure.ac', which is not yet the case.
>  AT_CHECK_MACRO([AC_CHECK_FILES],
> -[touch ac-exists1 ac-exists2
> -ac_exists2=ac-exists2
> -ac_missing2=ac-missing2
> -AC_CHECK_FILES(ac-exists1 ac-missing1 $ac_exists2 $ac_missing2)
> -rm ac-exists1 ac-exists2],
> +[touch at-exists1 at-exists2
> +ac_exists2=at-exists2
> +ac_missing2=at-missing2
> +AC_CHECK_FILES(at-exists1 at-missing1 $ac_exists2 $ac_missing2)
> +rm at-exists1 at-exists2],
>  [AT_CHECK_DEFINES(
> -[#define HAVE_AC_EXISTS1 1
> -/* #undef HAVE_AC_MISSING1 */
> +[#define HAVE_AT_EXISTS1 1
> +/* #undef HAVE_AT_MISSING1 */
>  ])])
>  
>  
> @@ -252,7 +252,7 @@ m4_define([AT_CHECK_PROGS_PREPARE],
>  AC_CHECK_PROGS(TOOL6, missing tool better,, $path)
>  test "$TOOL6" = tool || fail=:
>  
> -# no AC_OUTPUT, we don't need config.status.
> +# No AC-OUTPUT, we don't need config.status.
>  $fail &&
>    AC_MSG_ERROR([[CHECK_PROG failed]])
>  AS_EXIT(0)
> @@ -292,7 +292,7 @@ m4_define([AT_CHECK_PROGS_PREPARE],
>  AC_PATH_PROGS(TOOL4, missing tool better,, $path)
>  test "$TOOL4" = $pwd/path/1/tool || fail=:
>  
> -# no AC_OUTPUT, we don't need config.status.
> +# No AC-OUTPUT, we don't need config.status.
>  $fail &&
>    AC_MSG_ERROR([[PATH_PROG failed]])
>  AS_EXIT(0)
> Index: tests/tools.at
> --- tests/tools.at Wed, 17 Jan 2001 23:28:58 +0100 akim 
> (ace/b/30_tools.m4 1.32 644)
> +++ tests/tools.at Wed, 17 Jan 2001 23:46:25 +0100 akim 
> (ace/b/30_tools.m4 1.32 644)
> @@ -213,7 +213,7 @@ m4_define([TRACE2], [[$2], $1])
>  AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir 2>err], 1)
>  # The output of autoconf is not deterministic here because it
>  # uses `for (ind in array)'.  So be sure to have a unique 
> representation.
> -AT_CHECK([sort <err], 0,
> +AT_CHECK([grep '^configure' <err | sort], 0,
>  [[configure.ac:2: error: undefined macro: AC_FOO
>  configure.ac:3: error: undefined macro: _AC_BAR
>  configure.ac:4: error: undefined macro: m4_foo
> @@ -244,20 +244,21 @@ m4_define([TRACE2], [[$2], $1])
>  # Test Autoconf's patterns.
>  AC_THIS_IS_INVALID and AZ_THIS_IS_INVALID_TOO
>  BUT_AZ_THIS_IS_NOT ALTHOUGH_AC_THIS_IS
> -# This is legal, although there is `AC_DEFINE' in there.
> +# This is legal, although there is a forbidden pattern inside.
>  BAC_DEFINE
> -# AC_THIS_IS_A_COMMENT so just shut up.
> +# AC_THIS_IS_IN_A_COMMENT
>  It would be very bad if Autoconf forgot to expand [AC_]OUTPUT!
>  ]])
>  
>  AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir 2>err], 1)
>  # The output of autoconf is not deterministic here because it
>  # uses `for (ind in array)'.  So be sure to have a unique 
> representation.
> -AT_CHECK([sort <err], 0,
> +AT_CHECK([grep '^configure' <err | sort], 0,
>  [[configure.ac:10: error: undefined macro: FORBIDDEN
>  configure.ac:14: error: undefined macro: AC_THIS_IS_INVALID
>  configure.ac:14: error: undefined macro: AZ_THIS_IS_INVALID_TOO
>  configure.ac:15: error: undefined macro: ALTHOUGH_AC_THIS_IS
> +configure.ac:18: error: undefined macro: AC_THIS_IS_IN_A_COMMENT
>  configure.ac:7: error: undefined macro: AC_ALLOWED_NOT
>  configure.ac:7: error: undefined macro: NOT_AC_ALLOWED
>  configure:18: error: undefined macro: AC_OUTPUT
> 



reply via email to

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