Re: iterating over arguments

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

 



Eric Blake wrote:
Sam Steingold <sds <at> gnu.org> writes:


(drop m4_popdef, replace m4_pushdef with m4_define)

m4_pushdef/m4_popdef is nicer than m4_define, in that your use of the macro name becomes a local variable (you aren't corrupting state if anything else in the configure.ac happened to use the same name for an unrelated macro). But m4_define works all right if you have no reason to suspect that the macro name will ever collide.

interesting.

I thought that I was modifying a local variable.
e.g.,

(defun foo (bar)
  (setq bar (1+ bar)) ; modify a local binding; no effect outside of foo
  (print bar))

[1]> (defparameter bar 1)
BAR
[2]> (defun foo (bar) (incf bar) (print bar))
FOO
[3]> bar
1
[4]> (foo 10)

11
11
[5]> bar
1
[6]>

you appear to imply that

m4_foreach_w([cl_feat], [$1],
[ m4_define([cl_feat], ...) ])

leaks cl_feat outside of m4_foreach_w?

  m4_foreach_w([cl_feat], [$1],
-[m4_pushdef([CL_FEAT], m4_toupper(cl_feat))dnl
-AC_CACHE_CHECK([for CL_FEAT in CLISP], [cl_cv_clisp_]cl_feat,
+[m4_define([cl_feat], m4_toupper(cl_feat))dnl
+AC_CACHE_CHECK([for cl_feat in CLISP], [cl_cv_clisp_]cl_feat,

But if you are ALWAYS going to use the upper case version, then why not skip the m4_define altogether and do the upper-casing up front?

m4_foreach_w([cl_feat], m4_toupper([$1]),
[AC_CACHE_CHECK([for cl_feat in CLISP], ....

even better! will use this!

Thanks a lot!


_______________________________________________
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