bugGNU gettext - Bugs: bug #25416, xgettext incorrectly extracts...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #25416: xgettext incorrectly extracts comments in C when backslash is used

Submitted by:  None
Submitted on:  Mon 26 Jan 2009 11:00:44 PM UTC  
 
Category: CSeverity: 3 - Normal
Item Group: NoneStatus: Not a Bug
Privacy: PublicAssigned to: Bruno Haible <haible>
Open/Closed: Closed

Mon 26 Jan 2009 11:53:58 PM UTC, comment #1:

In C, backslash-newline is equivalent to no characters at all.
So the file that you showed effectively consists of a single
long line.

Yes, the result is a bit suboptimal in your case. But I see
xgettext's behaviour as a feature:
1) xgettext parses the source file like a C compiler would do.
2) When you really want to produce a long comment line, but
are limited to 80 columns by common coding conventions,
you can achieve that goal by using backslash-newline.
xgettext will eat up the backslash-newline, like a C
compiler.

The general advice for C, namely to use 'inline' functions
instead of multiline macros, will also help here.

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Mon 26 Jan 2009 11:00:44 PM UTC, original submission:

Let's have this test.c file:

$ cat test.c
#define A(X) \
/* comment \
* some comment \
* another line \
* third one */ \
int a = 10; \
printf(_("string"));
$

When the xgettext is invoked in this way:

$ xgettext -a -c test.c

The output is:

--------8<----------
[... snip ...]
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#. comment * some comment * another line * third one
#: test.c:7
#, c-format
msgid "string"
msgstr ""
--------8<----------

I see two problems here:

1. The comment should not be extracted because it is not directly preceeding the extracted string.
2. If extracted, the comment should be leaved intact and not merged to one line.

Anonymous

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by haible (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 27 Nov 2016 12:10:50 AM UTChaibleCategoryNone=>C
    Mon 26 Jan 2009 11:53:58 PM UTChaibleStatusNone=>Not a Bug
      Assigned toNone=>haible
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1