]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Add warning about empty msgid.
authorBruno Haible <bruno@clisp.org>
Sun, 23 Sep 2001 16:04:53 +0000 (16:04 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 23 Sep 2001 16:04:53 +0000 (16:04 +0000)
src/ChangeLog
src/xgettext.c

index 6706d791099ecc50e5502584ea392148501c5800..8b1501aa53f4cb35b8af1c12231691210b0ff180 100644 (file)
@@ -1,3 +1,8 @@
+2001-09-23  Bruno Haible  <haible@clisp.cons.org>
+
+       * xgettext.c (remember_a_message): Warn about empty msgid if it
+       conflicts with construct_header().
+
 2001-09-08  Bruno Haible  <haible@clisp.cons.org>
 
        * msgcat.c (main): Move the option checking after the handling of
index 890362e715aa7a23aa13ee8483812986650042e5..1b7713c9064fd4a83e2736d4afd697dc1613b2a9 100644 (file)
@@ -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);
     }