Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

false warning implicitly declaring library function 'strlcpy' #20819

Open Quuxplusone opened 10 years ago

Quuxplusone commented 10 years ago
Bugzilla Link PR20820
Status NEW
Importance P normal
Reported by Pavel Stehule (pavel.stehule@gmail.com)
Reported on 2014-08-30 22:56:43 -0700
Last modified on 2015-05-13 20:42:03 -0700
Version 3.4
Hardware PC Linux
CC david.majnemer@gmail.com, dgregor@apple.com, llvm-bugs@lists.llvm.org, noah@leadboat.com
Fixed by commit(s)
Attachments exec.i.gz (26700 bytes, application/binary)
Blocks
Blocked by
See also
clang -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-
statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-
strict-aliasing -fwrapv -g -DFRONTEND -I../../src/include -D_GNU_SOURCE -
I/usr/include/libxml2   -c -o exec.o exec.c
exec.c:280:2: warning: implicitly declaring library function 'strlcpy' with
type 'unsigned long
      (char *, const char *, unsigned long)'
        strlcpy(link_buf, fname, sizeof(link_buf));
        ^
exec.c:280:2: note: please include the header <string.h> or explicitly provide
a declaration for 'strlcpy'
1 warning generated.

It can be tested on Postgres master sources.
Quuxplusone commented 10 years ago

Please provide a preprocessed exec.c to aid in triaging this PR.

Quuxplusone commented 10 years ago

Attached exec.i.gz (26700 bytes, application/binary): gziped prepreprocessed exec.c

Quuxplusone commented 9 years ago
The problem arose because GNU Autoconf's AC_CHECK_DECLS macro relied on the
compiler reporting an error for a C program like "int main() { (void) strlcpy;
}".  Clang has always reported a warning, not an error, when the symbol at
issue is a builtin function.  Thus, the PostgreSQL "configure" script wrongly
concluded that system headers provided a strlcpy() declaration.

The next version of Autoconf will work around this Clang behavior:
http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=82ef7805faffa151e724aa76c245ec590d174580