Bug 62313 - Sources won't compile by ISO C99 compiler
Sources won't compile by ISO C99 compiler
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: gettext (Show other bugs)
7.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Trond Eivind Glomsrxd
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-03-29 10:23 EST by Sysoltsev Slawa
Modified: 2007-04-18 12:41 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-04-01 17:12:32 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Sysoltsev Slawa 2002-03-29 10:23:02 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Description of problem:
file src/po-lex.h, macro po_gram_error_at_line in case __STDC__ && (defined 
__STDC_VERSION__ && __STDC_VERSION__ >= 199901L:
# define po_gram_error_at_line(pos, fmt, ...)                               \
  do {                                                                      \
    error_at_line (0, 0, (pos)->file_name, (pos)->line_number,              \
                    fmt, __VA_ARGS__);                                      \
    if (*fmt == '.')                                                        \
      --error_message_count;                                                \
    else if (error_message_count >= gram_max_allowed_errors)                \
      error (1, 0, _("too many errors, aborting"));                         \
  } while (0)

This macro produces incorrect code when used only with 2 parameters (when ... 
becomes to nothing) and this happens while compiling msgcmp.c file:
msgcmp.c: In function `compare':
msgcmp.c:255: parse error before `)'
msgcmp.c:257: parse error before `)'
msgcmp.c:276: parse error before `)'
msgcmp.c: In function `compare_directive_message':
msgcmp.c:356: parse error before `)'
msgcmp.c:357: parse error before `)'
Problem is that macro doesn't discard extra comma. I tried to insert ## before 
__VA_ARGS__ and problem disappeared. 
Is this workaround good enough for the most Linux compilers conforming ISO C99?
Better than nothing.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. unpack & configure gettext-0.10.38-7.src.rpm
2. cd BUILD/gettext-0.10.38/src
3. gcc -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I../lib -
I../intl -I../intl    -O2 -march=i386 -mcpu=i686 -c msgcmp.c -std=c99
	

Actual Results:  Compile-time errors:
msgcmp.c: In function `compare':
msgcmp.c:255: parse error before `)'
msgcmp.c:257: parse error before `)'
msgcmp.c:276: parse error before `)'
msgcmp.c: In function `compare_directive_message':
msgcmp.c:356: parse error before `)'
msgcmp.c:357: parse error before `)'


Expected Results:  object file as a result of successful build.

Additional info:

If you provide branches in your sources for ISO C99 compliant compilers why 
these branches aren't work ?
Comment 1 Trond Eivind Glomsrxd 2002-04-01 17:12:28 EST
Reproduced with 0.11.1, reported upstream as well.
Comment 2 Trond Eivind Glomsrxd 2002-04-05 01:12:06 EST
Fixed in gettext-0.11.1-2.

Note You need to log in before you can comment on or make changes to this bug.