Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 248669

Summary: [Error Parser] gnu c/c++ error parser treats a warning as error
Product: [Tools] CDT Reporter: Miwako Tokugawa <miwako.tokugawa>
Component: cdt-buildAssignee: Andrew Gvozdev <angvoz.dev>
Status: RESOLVED FIXED QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: enhancement    
Priority: P3 CC: bill.hilliard, give.a.damus
Version: 5.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Miwako Tokugawa CLA 2008-09-25 18:13:08 EDT
create a helloc project with linux gcc and add a line
mktemp("anystr");

gcc will issue a warning in the linking phase
gcc -o "test" ./src/test.o
./src/mktemp.o(.text+0x19): In function 'main':
../src/mktemp.c:15: the use of 'mktemp' is dangerous, better use 'mkstemp'
but creates the exe.

gnu c/c++ error parser catches this and displays

the use of 'mktemp' is dangerous, better use 'mkstemp'

as an error.
Comment 1 Christian Damus CLA 2009-11-13 10:20:59 EST
This is the same symptom and cause as bug 75078, and is addressed by the patch attached to it (bug 75078 comment #13).

I would dupe the bug, but not sure that non-committers should do that.
Comment 2 Andrew Gvozdev CLA 2009-11-13 10:36:21 EST
> ../src/mktemp.c:15: the use of 'mktemp' is dangerous, better use 'mkstemp'
How does it solve this issue? I thought your patch solves ".text+0x19" problem which is not what this bug is about.
Comment 3 Christian Damus CLA 2009-11-13 11:14:51 EST
(In reply to comment #2)
> > ../src/mktemp.c:15: the use of 'mktemp' is dangerous, better use 'mkstemp'
> How does it solve this issue? I thought your patch solves ".text+0x19" problem
> which is not what this bug is about.

The only way to get this particular problem reported as an error marker in CDT 6.0.x is to build a Release configuration (no debug info) which then is picked up by the GNU Linker Error Parser's .text pattern as an error (bug 75078).

When building the Debug configuration, GNU C/C++ Error Parser correctly creates a warning marker and the linker error parser doesn't see it.  So, it seems that if the C/C++ error parser was a problem, it has since been fixed.  But the linker error parser is still broken.

The original bug report didn't indicate whether this is a debug or release build.  It looks like a release build because the linker reports a .text offset, but I don't know how to produce an error message that has both .text+0x19 and a source location.  Possibly the gcc version is a factor, too?  I'm using GCC 4.3.2-1ubuntu12.

Can you reproduce this bug as it is described?  If so, then this isn't a dupe.  Otherwise, maybe the resolution is "fixed accidentally?"  ;-)  In any case, I'm sorry if I caused confusion.
Comment 4 Andrew Gvozdev CLA 2009-11-13 12:18:42 EST
No I can't reproduce gcc message on cygwin. Miwako, what is GCC version?
Comment 5 Miwako Tokugawa CLA 2009-12-04 13:31:20 EST
(In reply to comment #4)
> No I can't reproduce gcc message on cygwin. Miwako, what is GCC version?
Hi. I'm using 
gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)
on RH EL5.

nhxlc200 1>cat 1.c
int main(void) {
mktemp("anystr");}
nhxlc200 2>gcc -c 1.c
nhxlc200 3>gcc -v 1.o
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)
 /usr/libexec/gcc/i386-redhat-linux/4.1.1/collect2 --eh-frame-hdr -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../crt1.o /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../crti.o /usr/lib/gcc/i386-redhat-linux/4.1.1/crtbegin.o -L/usr/lib/gcc/i386-redhat-linux/4.1.1 -L/usr/lib/gcc/i386-redhat-linux/4.1.1 -L/usr/lib/gcc/i386-redhat-linux/4.1.1/../../.. 1.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/i386-redhat-linux/4.1.1/crtend.o /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../crtn.o
1.o: In function `main':
1.c:(.text+0x19): warning: the use of `mktemp' is dangerous, better use `mkstemp'
Comment 6 Andrew Gvozdev CLA 2010-02-04 22:49:33 EST
Fixed on HEAD (7.0). It's a warning now.  Messages "In function..." are ignored to avoid noise. Additionally added the pattern to GCC Error parser under bug 263987.