From 84db2ecbb452733d662754a4dfcd9b0087bf210f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 23 Sep 2001 16:04:53 +0000 Subject: [PATCH] Add warning about empty msgid. --- src/ChangeLog | 5 +++++ src/xgettext.c | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 6706d7910..8b1501aa5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2001-09-23 Bruno Haible + + * xgettext.c (remember_a_message): Warn about empty msgid if it + conflicts with construct_header(). + 2001-09-08 Bruno Haible * msgcat.c (main): Move the option checking after the handling of diff --git a/src/xgettext.c b/src/xgettext.c index 890362e71..1b7713c90 100644 --- a/src/xgettext.c +++ b/src/xgettext.c @@ -41,6 +41,7 @@ #include "file-list.h" #include "error.h" #include "progname.h" +#include "xerror.h" #include "getline.h" #include "system.h" #include "po.h" @@ -809,6 +810,18 @@ remember_a_message (mlp, string, pos) is_format[i] = undecided; do_wrap = undecided; + if (msgid[0] == '\0' && !omit_header) + { + error_with_progname = false; + multiline_warning (xasprintf ("%s:%d: warning: ", pos->file_name, + pos->line_number), + xstrdup (_("\ +Empty msgid. It is reserved by GNU gettext:\n\ +gettext(\"\") returns the header entry with\n\ +meta information, not the empty string.\n"))); + error_with_progname = true; + } + /* See if we have seen this message before. */ mp = message_list_search (mlp, msgid); if (mp != NULL) @@ -820,7 +833,7 @@ remember_a_message (mlp, string, pos) } else { - static lex_pos_ty pos = { __FILE__, __LINE__ }; + static lex_pos_ty dummypos = { __FILE__, __LINE__ }; /* Construct the msgstr from the prefix and suffix, otherwise use the empty string. */ @@ -836,7 +849,7 @@ remember_a_message (mlp, string, pos) msgstr = ""; /* Allocate a new message and append the message to the list. */ - mp = message_alloc (msgid, NULL, msgstr, strlen (msgstr) + 1, &pos); + mp = message_alloc (msgid, NULL, msgstr, strlen (msgstr) + 1, &dummypos); /* Do not free msgid. */ message_list_append (mlp, mp); } -- 2.47.3