Bug 15960 - Error during build gdb with MinGW on Windows -> util.c
Summary: Error during build gdb with MinGW on Windows -> util.c
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 7.6
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-16 21:07 UTC by hager-markus
Modified: 2014-02-16 01:45 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hager-markus 2013-09-16 21:07:09 UTC
I tried to build GDB 7.6 (same error with 7.6.1) on Windows 7 using MinGW with msys terminal. I changed none of the standard configuration, just unpacked everything and performed ./configure and ./make

The problem occurred during compilation of file gdb-7.6\readline\util.c

I fixed a missing ; in line 392 (closed do-while-loop at end of '_rl_strnicmp'-function).

Best regards,
Markus
Comment 1 Yao Qi 2013-09-17 06:51:01 UTC
Markus,
It would be useful to post the error message you got when you build GDB, and the version of GCC you used, so that other people can reproduce the problem in their env.

If you have a patch to fix the error, you can contribute it.  Please read https://sourceware.org/gdb/wiki/ContributionChecklist for more details.
Comment 2 hager-markus 2013-09-17 09:52:53 UTC
gcc version: 4.8.1

error message:
util.c: In function '_rl_strnicmp':
util.c:394:3: error: expected ';' before 'return'
    return (0);
    ^

I guess this occurs only during the build on windows because otherwise I couldn't imagine why this error wasn't discovered earlier. By the way, if you look into the util.c I think this error is quite obvious, or is there any case where the ; could be missed?

Best regards,
Markus
Comment 3 Yao Qi 2013-09-17 10:27:55 UTC
(In reply to hager-markus from comment #2)
> gcc version: 4.8.1
> 
> error message:
> util.c: In function '_rl_strnicmp':
> util.c:394:3: error: expected ';' before 'return'
>     return (0);
>     ^
> 
> I guess this occurs only during the build on windows because otherwise I
> couldn't imagine why this error wasn't discovered earlier. By the way, if
> you look into the util.c I think this error is quite obvious, or is there
> any case where the ; could be missed?
> 

I am using i686-pc-mingw32-gcc to cross compile GDB for windows.  I didn't see the error before.  This piece of code is surrounded by #if !defined (HAVE_STRCASECMP) and #endif, HAVE_STRCASECMP is defined in my config.h.  This piece of code is not compiled for me, and probably that is the reason why I didn't see this error before.

GDB is using readline from (http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html).  Please report this error to bug-readline@gnu.org, get it fixed, and then backport the fix to GDB.
Comment 4 asmwarrior 2013-09-17 10:44:49 UTC
I don't have such build error, I'm using msys1 and mingw-gcc 4.6.3 dw2 version.
Yuanhui Zhang
Comment 5 hager-markus 2013-09-19 16:29:59 UTC
> Please report
> this error to bug-readline@gnu.org, get it fixed, and then backport the fix
> to GDB.

I received the following from the readline-team, so it is already fixed:

Thanks for the report. This was reported and fixed earlier. Adding the
semicolon is the right fix. This is a lightly-used piece of code
(obviously), so I probably will not release it as a patch. The gdb
developers can put in the straightforward fix and move forward.

Chet
Comment 6 Yao Qi 2014-02-16 01:45:11 UTC
Patch was committed.  Close this PR.

2013-09-23  Martin Benda  <martin.benda@omsquare.com>

        Checked in by Joel Brobecker  <brobecker@adacore.com>
        * util.c (_rl_strnicmp): Add missing semicolon.