bug-gnulib
[Top][All Lists]
Advanced

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

Issue detecting macro definition for gets with GCC 5


From: Jörg Krause
Subject: Issue detecting macro definition for gets with GCC 5
Date: Thu, 06 Aug 2015 15:40:44 +0200

The configure check for gets is false for GCC 5:
    checking whether gets is declared without a macro... yes

However, compiling the simple main.c:
    #include <stdio.h>
        
    int main()
    {
    #undef gets
      (void) gets
      ;
      return 0;
    }
    m4/stdio_h.m4


with gcc5 main.c fails with an error:
    main.c:6:10: error: ‘gets’ undeclared

However G++ allows it, g++5 main.c:
    warning: ‘char* gets(char*)’ is deprecated

If the compile check for gets is forced to run with the C compiler,
gettext compiles succesfully, otherwise it fails with:
    error: 'gets' undeclared here (not in a function)

My quick & dirty patch for stdio_h.m4:

diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index f60cc21..cc809ae 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -100,6 +100,8 @@ AC_DEFUN([gl_STDIO_H],
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use, and which is not
   dnl guaranteed by both C89 and C11.
+  dnl gets compiles with G++ 5, but fails with GCC 5. Force check with
GCC.
+  AC_LANG(C)
   gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
     ]], [dprintf fpurge fseeko ftello getdelim getline gets pclose
popen
     renameat snprintf tmpfile vdprintf vsnprintf])
--

I'm not sure if this is done correctly. I'm very new to autotools...

Best regards
Jörg Krause



reply via email to

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