mainAutoconf - Support: sr #110400, autoconf 2.70 no longer supports...

 
 

sr #110400: autoconf 2.70 no longer supports clang with -Wextra-semi-stmt warning enabled

Submitter:  Bruno Haible <haible>
Submitted:  Sat 12 Dec 2020 01:58:29 AM UTC
   
 
Priority:  * 5 - Unprioritized Severity:  3 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 23 Dec 2020 07:07:27 PM UTC, comment #6: 

Fixed in ec90049dfcf4538750e61d675d885157fa5ca7f8 (trunk) and de36ccf6637974f4faba3747813d38ee46e77d69 (branch-2.70).

Zack Weinberg <zackw>
Group administrator
Sat 12 Dec 2020 07:41:27 PM UTC, comment #5: 


> I'm not all that familiar with clang.  Does anyone have a better idea for how to handle this quirk it has?

Commit 82ef7805faffa151e724aa76c245ec590d174580 says "Passing -fno-builtin to the compiler would suppress this problem." All things considered, with hindsight that might be a better solution than the one adopted in the commit.

Paul Eggert <eggert>
Group administrator
Sat 12 Dec 2020 03:05:34 AM UTC, comment #4: 

Oh, forgot to mention, I don't think we can remove that extra semicolon from AC_LANG_PROGRAM.  I expect there are zillions of custom tests out there that do things like


AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[return 1 == 2]]),
     [...], [...])


and rely on AC_LANG_PROGRAM to supply the semicolon.

Zack Weinberg <zackw>
Group administrator
Sat 12 Dec 2020 03:02:03 AM UTC, comment #3: 

AC_LANG_PROGRAM(C) generates the same empty statement in 2.69.  However, the "checking how $CC reports undeclared, standard C functions" test is new in 2.70.  It seems to have been added specifically for Clang's sake, in commit 82ef7805faffa151e724aa76c245ec590d174580.

I don't like the way the logic added in this commit works -- even if we can find a fix for the specific problem you hit, it seems likely to be trouble in the future, not only for itself but for other tests.  I added a whole block of text to NEWS about how "running configure tests with warnings promoted to errors is not supported" and now I discover we're doing that exact thing ourselves :-(  Only for AC_CHECK_DECL(S), but still.

I'm not all that familiar with clang.  Does anyone have a better idea for how to handle this quirk it has?

Zack Weinberg <zackw>
Group administrator
Sat 12 Dec 2020 02:32:15 AM UTC, comment #2: 

The workaround is to add option -Wno-extra-semi-stmt after the -Wall option, e.g. on Windows systems: CC="$HOME/compile clang-cl -Wall -Wno-extra-semi-stmt".

Bruno Haible <haible>
Sat 12 Dec 2020 02:02:12 AM UTC, comment #1: 

The error happens in the expansion of the macro _AC_UNDECLARED_WARNING:


      # For AC_CHECK_DECL to react to warnings, the compiler must be silent on
    # valid AC_CHECK_DECL input.  No library function is consistently available
    # on freestanding implementations, so test against a dummy declaration.
    # Include always-available headers on the off chance that they somehow
    # elicit warnings.
    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <float.h>
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
extern void ac_decl (int, char *);
int
main (void)
{
#ifdef __cplusplus
  (void) ac_decl ((int) 0, (char *) 0);
  (void) ac_decl;
#else
  (void) ac_decl;
#endif

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
  if test -s conftest.err
then :
  { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot detect from compiler exit status or warnings
See \`config.log' for more details" "$LINENO" 5; }


The problem here is the semicolon before 'return 0', which comes from the AC_LANG_PROGRAM macro. It triggers a clang warning. And since all or most test programs used by Autoconf are pieced together using AC_LANG_PROGRAM, the presence of warnings cannot be used to detect anything about the test program.

Bruno Haible <haible>
Sat 12 Dec 2020 01:58:29 AM UTC, original submission:  

This worked with autoconf 2.69 generated configure files; with autoconf 2.70 generated configure files the configuration aborts like this:


checking how clang -Wextra-semi-stmt reports undeclared, standard C functions... configure: error: in `/testdir1/build-64':
configure: error: cannot detect from compiler exit status or warnings
See `config.log' for more details


This can be reproduced:
a) on a Unix system, with CC="clang -Wall -Wextra-semi-stmt",
b) on a Windows system, with CC="$HOME/compile clang-cl -Wall".

(Apparently 'clang-cl' enables some more warnings on Windows, than 'clang' on Unix. Probably for MSVC compatibility.)

Bruno Haible <haible>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by eggert (Posted a comment)
  • -email is unavailable- added by zackw (Posted a comment)
  • -email is unavailable- added by haible (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-12-23 zackw StatusNone Done
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code