paul-j-lucas / cdecl

Composing and deciphering C (or C++) declarations or casts, aka ‘‘gibberish.’’
GNU General Public License v3.0
90 stars 11 forks source link

Autoconf: `AX_CFLAGS_GCC_OPTION` deprecation, crustiness, warnings, etc #8

Closed jgottula closed 3 years ago

jgottula commented 3 years ago

So, I was building this project for the first time today, and I was a bit overwhelmed with the quantity of autoconf warnings I saw.

Basically a ton of repetitions of these two chunks:

configure.ac:188: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:188: You should run autoupdate.
./lib/autoconf/c.m4:72: AC_LANG_C is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2248: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2269: AC_CACHE_CHECK is expanded from...
m4/ax_cflags_gcc_option.m4:118: AX_CFLAGS_GCC_OPTION_NEW is expanded from...
m4/ax_cflags_gcc_option.m4:187: AX_CFLAGS_GCC_OPTION is expanded from...
configure.ac:188: the top level
configure.ac:188: warning: The macro `AC_TRY_COMPILE' is obsolete.
configure.ac:188: You should run autoupdate.
./lib/autoconf/general.m4:2846: AC_TRY_COMPILE is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2248: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2269: AC_CACHE_CHECK is expanded from...
m4/ax_cflags_gcc_option.m4:118: AX_CFLAGS_GCC_OPTION_NEW is expanded from...
m4/ax_cflags_gcc_option.m4:187: AX_CFLAGS_GCC_OPTION is expanded from...
configure.ac:188: the top level

(Contrary to what the latter warning says, autoupdate doesn't actually do anything.)

I did notice that AX_CFLAGS_GCC_OPTION is very obsolete... like, very very obsolete... like, removed-from-autoconf-archive-in-2011 obsolete. So that would tend to explain why it's using really old macros.

However I also noticed that the version of AX_CFLAGS_GCC_OPTION in this repo isn't even the most recent version of it before it was deprecated and then removed. There's a somewhat-newer (well, 2011, anyway) version of the file that is greatly simplified and which also doesn't trigger any obsolete macro warnings. Here's a link to that very-last version: http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_cflags_gcc_option.m4;hb=88f3e44a62f122149c849044ed5cd63b48d6fda3

I dropped it in over the older version included in the repo, and aside from all the autoconf warnings clearing up, the behavior appeared to be identical (I tested with both GCC and Clang and it seemed to have the same results as before).

So, if abandoning AX_CFLAGS_GCC_OPTION entirely isn't super appealing, you should still be able to at least use a newer old macro version and end up with at least somewhat less crustiness overall. 👍

paul-j-lucas commented 3 years ago

There's a somewhat-newer (well, 2011, anyway) version of the file that is greatly simplified and which also doesn't trigger any obsolete macro warnings.

The last update was in 2018 and it's the version that's included in the cdecl repo. That said, I must have added it, but forgot to change configure.ac to use it instead of AX_CFLAGS_GCC_OPTION.

jgottula commented 3 years ago

Oh okay yeah.

I was going to mention that AX_CHECK_COMPILE_FLAG was basically the recommended modern substitute; but I assumed there was some particular reason you'd intentionally stuck to using AX_CFLAGS_GCC_OPTION. Hence why I went with the "well, there is at the very least a less-old version of AX_CFLAGS_GCC_OPTION out there" path in the original post.

It looks like 44ef25068415090c4c1569b9053fc3907eadfe7b renders this issue resolved, so I'll go ahead and close.

I appreciate the quick updates; and I appreciate this project overall as a very-modernized take on cdecl! I'd tried using the more widely-available variants of cdecl before, but they were all simply much too far out of date to be particularly practical. Having C++20 support out of the box is amazing for all the times where I'm building a modern template class and go "ah shit, what even is the weirdo return type for this special accessor thingie when T happens to be a reference to a pointer-const to an array of function pointers" and I don't want to have to use a bunch of using statements to build up the damn thing. (And for the various cases where auto sadly can't just figure everything out for me automagically.)