[Bug preprocessor/60022] New: macro _(Text) generates warning: implicit declaration of function '_' [-Wimplicit-function-declaration]

richard at netbsd dot org gcc-bugzilla@gcc.gnu.org
Sat Feb 1 09:49:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60022

            Bug ID: 60022
           Summary: macro  _(Text)  generates warning: implicit
                    declaration of function '_'
                    [-Wimplicit-function-declaration]
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: richard at netbsd dot org

I believe I'm up against a regression in gcc 4.8.3 building the package
rpm-4.11.1

I witness the following:

rpmfileutil.c: In function 'rpmMkTempFile':
rpmfileutil.c:255:2: warning: implicit declaration of function '_'
[-Wimplicit-function-declaration]
  rpmlog(RPMLOG_ERR, _("error creating temporary file %s: %m\n"), tempfn);
  ^
rpmfileutil.c:255:2: warning: passing argument 2 of 'rpmlog' makes pointer from
integer without a cast [enabled by default]
In file included from rpmfileutil.c:26:0:
../include/rpm/rpmlog.h:225:6: note: expected 'const char *' but argument is of
type 'int'
 void rpmlog (int code, const char *fmt, ...) RPM_GNUC_PRINTF(2, 3);
      ^
...

naturally giving the following during link-editing:

Undefined            first referenced
 symbol                  in file
_                                   rpmio/.libs/librpmio.so
ld: fatal: symbol referencing errors. No output written to .libs/rpm2cpio
collect2: error: ld returned 1 exit status
Makefile:936: recipe for target 'rpm2cpio' failed
gmake[2]: *** [rpm2cpio] Error 1


extract from configure'd system.h:

/* Take care of NLS matters.  */
#if ENABLE_NLS
# include <locale.h>
# include <libintl.h>
# define _(Text) dgettext (PACKAGE, Text)
#else
# define _(Text) Text
#endif

#define N_(Text) Text


ENABLE_NLS is defined, and the macro '_(Text)' seems to be ignored
(turning off NLS changes nothing, as can be expected.

I also tried building with CFLAGS+=-no-integrated-cpp to no avail.

Is this a regression, or does gcc 4.8.x enforce new rules as to macro names?
NB: This program builds fine with gcc 4.7.3.

I'm building using pkgsrc with gcc configured as follows:
$ /opt/local/gcc48/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/opt/local/gcc48/bin/gcc
COLLECT_LTO_WRAPPER=/opt/local/gcc48/libexec/gcc/x86_64-sun-solaris2.11/4.8.2/lto-wrapper
Target: x86_64-sun-solaris2.11
Configured with: ../gcc-4.8.2/configure --enable-languages='c obj-c++ objc go
fortran c++' --enable-shared --enable-long-long
--with-local-prefix=/opt/local/gcc48 --enable-libssp --enable-threads=posix
--with-boot-ldflags='-static-libstdc++ -static-libgcc -Wl,-R/opt/local/lib '
--disable-nls --with-cloog=/opt/local --enable-cloog-backend=isl
--enable-__cxa_atexit --with-gxx-include-dir=/opt/local/gcc48/include/c++/
--with-gnu-as --with-as=/usr/gnu/bin/as --without-gnu-ld --with-ld=/usr/bin/ld
--prefix=/opt/local/gcc48 --build=x86_64-sun-solaris2.11
--host=x86_64-sun-solaris2.11 --infodir=/opt/local/gcc48/info
--mandir=/opt/local/gcc48/man
Thread model: posix
gcc version 4.8.2 (GCC)



More information about the Gcc-bugs mailing list