bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gettext: compilation/link errors (DLL on MinGW/MSYS (Win32))


From: Mark Junker
Subject: gettext: compilation/link errors (DLL on MinGW/MSYS (Win32))
Date: Mon, 06 Jun 2005 16:20:37 +0200
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Hi,

I've found some errors during compilation of gettext for MinGW/MSYS (Win32). The attached patch fixes only problem #4 because I am very busy completing another (commercial) product. Sorry.

1. Compilation for C# referencing "GNU.Gettext" doesn't work. On Win32 platforms, you must specify as "GNU.Gettext.dll" as library

The Makefile.am that's affected is gettext-tools/src/Makefile.am. The compilation of msgunfmt.net.exe from msgunfmt.cs must use -l GNU.Gettext.dll. I think that s/o has to update configure.ac to export the DLL (shared object) extension.

2. On MinGW, the mbrtowc function can only be found in the libmsvcp60 library.

You have to add -lmsvcp60 on the MinGW/MSYS platform in gettext-tools/lib/Makefile.am and gettext-tools/src/Makefile.am to get the mbrtowc function. However, the current work-around is to export LIBS="-lmsvcp60" but the build process should work out-of-the-box ...

3. -lc must not be used on the MinGW platform

The libc simply doesn't exist on MinGW. This affects gettext-tools/lib/Makefile.am and gettext-tools/src/Makefile.am.

4. Accessing variables in shared libraries

The auto-import for variables from DLLs can fail on the MinGW (Win32) platform when you:
- query the variables address (causes an exception fault)
- use something like "plural_table[i].lang", the auto-import simply fails

I attached a patch that fixes this problem.

5. When making a "make install", it recurses into gettext-tools/examples/hello-c. AFAIK this is an error too because it prevents a make install from completion.

Regards,
Mark

Index: gettext-tools/src/msgattrib.c
===================================================================
RCS file: /cvs/gettext/gettext/gettext-tools/src/msgattrib.c,v
retrieving revision 1.12
diff -u -r1.12 msgattrib.c
--- gettext-tools/src/msgattrib.c       20 May 2005 21:06:04 -0000      1.12
+++ gettext-tools/src/msgattrib.c       6 Jun 2005 12:40:15 -0000
@@ -68,10 +68,12 @@
 };
 static int to_change;
 
+static int tmp_line_comment = 0;
+
 /* Long options.  */
 static const struct option long_options[] =
 {
-  { "add-location", no_argument, &line_comment, 1 },
+  { "add-location", no_argument, &tmp_line_comment, 1 },
   { "clear-fuzzy", no_argument, NULL, CHAR_MAX + 8 },
   { "clear-obsolete", no_argument, NULL, CHAR_MAX + 10 },
   { "directory", required_argument, NULL, 'D' },
@@ -83,7 +85,7 @@
   { "indent", no_argument, NULL, 'i' },
   { "no-escape", no_argument, NULL, 'e' },
   { "no-fuzzy", no_argument, NULL, CHAR_MAX + 3 },
-  { "no-location", no_argument, &line_comment, 0 },
+  { "no-location", no_argument, &tmp_line_comment, 0 },
   { "no-obsolete", no_argument, NULL, CHAR_MAX + 5 },
   { "no-wrap", no_argument, NULL, CHAR_MAX + 13 },
   { "obsolete", no_argument, NULL, CHAR_MAX + 12 },
@@ -158,9 +160,12 @@
   input_file = NULL;
   only_file = NULL;
   ignore_file = NULL;
+  tmp_line_comment = line_comment;
 
   while ((optchar = getopt_long (argc, argv, "D:eEFhino:pPsVw:", long_options,
                                 NULL)) != EOF)
+  {
+    line_comment = tmp_line_comment;
     switch (optchar)
       {
       case '\0':               /* Long option.  */
@@ -191,7 +196,7 @@
        break;
 
       case 'n':
-       line_comment = 1;
+       tmp_line_comment = line_comment = 1;
        break;
 
       case 'o':
@@ -302,6 +307,7 @@
        usage (EXIT_FAILURE);
        /* NOTREACHED */
       }
+  }
 
   /* Version information requested.  */
   if (do_version)
Index: gettext-tools/src/msgcat.c
===================================================================
RCS file: /cvs/gettext/gettext/gettext-tools/src/msgcat.c,v
retrieving revision 1.12
diff -u -r1.12 msgcat.c
--- gettext-tools/src/msgcat.c  20 May 2005 21:06:04 -0000      1.12
+++ gettext-tools/src/msgcat.c  6 Jun 2005 12:39:39 -0000
@@ -52,10 +52,12 @@
 /* Target encoding.  */
 static const char *to_code;
 
+static int tmp_line_comment = 0;
+
 /* Long options.  */
 static const struct option long_options[] =
 {
-  { "add-location", no_argument, &line_comment, 1 },
+  { "add-location", no_argument, &tmp_line_comment, 1 },
   { "directory", required_argument, NULL, 'D' },
   { "escape", no_argument, NULL, 'E' },
   { "files-from", required_argument, NULL, 'f' },
@@ -63,7 +65,7 @@
   { "help", no_argument, NULL, 'h' },
   { "indent", no_argument, NULL, 'i' },
   { "no-escape", no_argument, NULL, 'e' },
-  { "no-location", no_argument, &line_comment, 0 },
+  { "no-location", no_argument, &tmp_line_comment, 0 },
   { "no-wrap", no_argument, NULL, CHAR_MAX + 2 },
   { "output-file", required_argument, NULL, 'o' },
   { "properties-input", no_argument, NULL, 'P' },
@@ -131,9 +133,12 @@
   more_than = 0;
   less_than = INT_MAX;
   use_first = false;
+  tmp_line_comment = line_comment;
 
   while ((optchar = getopt_long (argc, argv, "<:>:D:eEf:Fhino:pPst:uVw:",
                                 long_options, NULL)) != EOF)
+  {
+    line_comment = tmp_line_comment;
     switch (optchar)
       {
       case '\0':               /* Long option.  */
@@ -188,7 +193,7 @@
        break;
 
       case 'n':
-       line_comment = 1;
+       tmp_line_comment = line_comment = 1;
        break;
 
       case 'o':
@@ -254,6 +259,7 @@
        usage (EXIT_FAILURE);
        /* NOTREACHED */
       }
+  }
 
   /* Version information requested.  */
   if (do_version)
Index: gettext-tools/src/msgcomm.c
===================================================================
RCS file: /cvs/gettext/gettext/gettext-tools/src/msgcomm.c,v
retrieving revision 1.12
diff -u -r1.12 msgcomm.c
--- gettext-tools/src/msgcomm.c 20 May 2005 21:06:04 -0000      1.12
+++ gettext-tools/src/msgcomm.c 6 Jun 2005 12:41:11 -0000
@@ -54,10 +54,12 @@
 /* Target encoding.  */
 static const char *to_code;
 
+static int tmp_line_comment = 0;
+
 /* Long options.  */
 static const struct option long_options[] =
 {
-  { "add-location", no_argument, &line_comment, 1 },
+  { "add-location", no_argument, &tmp_line_comment, 1 },
   { "directory", required_argument, NULL, 'D' },
   { "escape", no_argument, NULL, 'E' },
   { "files-from", required_argument, NULL, 'f' },
@@ -65,7 +67,7 @@
   { "help", no_argument, NULL, 'h' },
   { "indent", no_argument, NULL, 'i' },
   { "no-escape", no_argument, NULL, 'e' },
-  { "no-location", no_argument, &line_comment, 0 },
+  { "no-location", no_argument, &tmp_line_comment, 0 },
   { "no-wrap", no_argument, NULL, CHAR_MAX + 2 },
   { "omit-header", no_argument, NULL, CHAR_MAX + 1 },
   { "output", required_argument, NULL, 'o' }, /* for backward compatibility */
@@ -129,9 +131,12 @@
   more_than = -1;
   less_than = -1;
   use_first = false;
+  tmp_line_comment = line_comment;
 
   while ((optchar = getopt_long (argc, argv, "<:>:D:eEf:Fhino:pPst:uVw:",
                                 long_options, NULL)) != EOF)
+  {
+    tmp_line_comment = line_comment;
     switch (optchar)
       {
       case '\0':               /* Long option.  */
@@ -186,7 +191,7 @@
        break;
 
       case 'n':
-       line_comment = 1;
+       tmp_line_comment = line_comment = 1;
        break;
 
       case 'o':
@@ -265,6 +270,7 @@
       printf (_("Written by %s.\n"), "Peter Miller");
       exit (EXIT_SUCCESS);
     }
+  }
 
   /* Help is requested.  */
   if (do_help)
Index: gettext-tools/src/msgconv.c
===================================================================
RCS file: /cvs/gettext/gettext/gettext-tools/src/msgconv.c,v
retrieving revision 1.11
diff -u -r1.11 msgconv.c
--- gettext-tools/src/msgconv.c 20 May 2005 21:06:04 -0000      1.11
+++ gettext-tools/src/msgconv.c 6 Jun 2005 12:42:10 -0000
@@ -51,17 +51,19 @@
 /* Target encoding.  */
 static const char *to_code;
 
+static int tmp_line_comment = 0;
+
 /* Long options.  */
 static const struct option long_options[] =
 {
-  { "add-location", no_argument, &line_comment, 1 },
+  { "add-location", no_argument, &tmp_line_comment, 1 },
   { "directory", required_argument, NULL, 'D' },
   { "escape", no_argument, NULL, 'E' },
   { "force-po", no_argument, &force_po, 1 },
   { "help", no_argument, NULL, 'h' },
   { "indent", no_argument, NULL, 'i' },
   { "no-escape", no_argument, NULL, 'e' },
-  { "no-location", no_argument, &line_comment, 0 },
+  { "no-location", no_argument, &tmp_line_comment, 0 },
   { "no-wrap", no_argument, NULL, CHAR_MAX + 1 },
   { "output-file", required_argument, NULL, 'o' },
   { "properties-input", no_argument, NULL, 'P' },
@@ -120,10 +122,13 @@
   do_version = false;
   output_file = NULL;
   input_file = NULL;
+  tmp_line_comment = line_comment;
 
   while ((opt = getopt_long (argc, argv, "D:eEFhio:pPst:Vw:", long_options,
                             NULL))
         != EOF)
+  {
+    line_comment = tmp_line_comment;
     switch (opt)
       {
       case '\0':               /* Long option.  */
@@ -208,6 +213,7 @@
        usage (EXIT_FAILURE);
        break;
       }
+  }
 
   /* Version information is requested.  */
   if (do_version)
Index: gettext-tools/src/msgen.c
===================================================================
RCS file: /cvs/gettext/gettext/gettext-tools/src/msgen.c,v
retrieving revision 1.12
diff -u -r1.12 msgen.c
--- gettext-tools/src/msgen.c   20 May 2005 21:06:04 -0000      1.12
+++ gettext-tools/src/msgen.c   6 Jun 2005 12:43:02 -0000
@@ -47,17 +47,19 @@
 /* Force output of PO file even if empty.  */
 static int force_po;
 
+static int tmp_line_comment = 0;
+
 /* Long options.  */
 static const struct option long_options[] =
 {
-  { "add-location", no_argument, &line_comment, 1 },
+  { "add-location", no_argument, &tmp_line_comment, 1 },
   { "directory", required_argument, NULL, 'D' },
   { "escape", no_argument, NULL, 'E' },
   { "force-po", no_argument, &force_po, 1 },
   { "help", no_argument, NULL, 'h' },
   { "indent", no_argument, NULL, 'i' },
   { "no-escape", no_argument, NULL, 'e' },
-  { "no-location", no_argument, &line_comment, 0 },
+  { "no-location", no_argument, &tmp_line_comment, 0 },
   { "no-wrap", no_argument, NULL, CHAR_MAX + 1 },
   { "output-file", required_argument, NULL, 'o' },
   { "properties-input", no_argument, NULL, 'P' },
@@ -112,9 +114,12 @@
   do_help = false;
   do_version = false;
   output_file = NULL;
+  tmp_line_comment = line_comment;
 
   while ((opt = getopt_long (argc, argv, "D:eEFhio:pPsVw:", long_options, 
NULL))
         != EOF)
+  {
+    line_comment = tmp_line_comment;
     switch (opt)
       {
       case '\0':               /* Long option.  */
@@ -194,6 +199,7 @@
        usage (EXIT_FAILURE);
        break;
       }
+  }
 
   /* Version information is requested.  */
   if (do_version)
Index: gettext-tools/src/msgfilter.c
===================================================================
RCS file: /cvs/gettext/gettext/gettext-tools/src/msgfilter.c,v
retrieving revision 1.21
diff -u -r1.21 msgfilter.c
--- gettext-tools/src/msgfilter.c       20 May 2005 21:06:04 -0000      1.21
+++ gettext-tools/src/msgfilter.c       6 Jun 2005 12:43:37 -0000
@@ -96,10 +96,12 @@
 static char **sub_argv;
 static int sub_argc;
 
+static int tmp_line_comment = 0;
+
 /* Long options.  */
 static const struct option long_options[] =
 {
-  { "add-location", no_argument, &line_comment, 1 },
+  { "add-location", no_argument, &tmp_line_comment, 1 },
   { "directory", required_argument, NULL, 'D' },
   { "escape", no_argument, NULL, 'E' },
   { "force-po", no_argument, &force_po, 1 },
@@ -108,7 +110,7 @@
   { "input", required_argument, NULL, 'i' },
   { "keep-header", no_argument, &keep_header, 1 },
   { "no-escape", no_argument, NULL, CHAR_MAX + 2 },
-  { "no-location", no_argument, &line_comment, 0 },
+  { "no-location", no_argument, &tmp_line_comment, 0 },
   { "no-wrap", no_argument, NULL, CHAR_MAX + 3 },
   { "output-file", required_argument, NULL, 'o' },
   { "properties-input", no_argument, NULL, 'P' },
@@ -167,12 +169,15 @@
   do_version = false;
   output_file = NULL;
   input_file = NULL;
+  tmp_line_comment = line_comment;
 
   /* The '+' in the options string causes option parsing to terminate when
      the first non-option, i.e. the subprogram name, is encountered.  */
   while ((opt = getopt_long (argc, argv, "+D:EFhi:o:pPsVw:", long_options,
                             NULL))
         != EOF)
+  {
+    line_comment = tmp_line_comment;
     switch (opt)
       {
       case '\0':               /* Long option.  */
@@ -261,6 +266,7 @@
        usage (EXIT_FAILURE);
        break;
       }
+  }
 
   /* Version information is requested.  */
   if (do_version)
Index: gettext-tools/src/msgfmt.c
===================================================================
RCS file: /cvs/gettext/gettext/gettext-tools/src/msgfmt.c,v
retrieving revision 1.23
diff -u -r1.23 msgfmt.c
--- gettext-tools/src/msgfmt.c  20 May 2005 21:06:04 -0000      1.23
+++ gettext-tools/src/msgfmt.c  6 Jun 2005 10:48:27 -0000
@@ -1114,21 +1114,26 @@
          language = strstr (nullentry, "Language-Team: ");
          if (language != NULL)
            {
+              /* to avoid optimization that avoids the usage of gram_pos from
+                 a Win32 DLL. */
+              const struct plural_table_entry *entry = plural_table;
              language += 15;
-             for (j = 0; j < plural_table_size; j++)
-               if (strncmp (language,
-                            plural_table[j].language,
-                            strlen (plural_table[j].language)) == 0)
-                 {
-                   char *recommended =
-                     xasprintf ("Plural-Forms: %s\\n", plural_table[j].value);
-                   fprintf (stderr,
-                            _("Try using the following, valid for %s:\n"),
-                            plural_table[j].language);
-                   fprintf (stderr, "\"%s\"\n", recommended);
-                   free (recommended);
-                   break;
-                 }
+              for (j = 0; j < plural_table_size; ++entry, ++j)
+                {
+                  if (strncmp (language,
+                               entry->language,
+                               strlen (entry->language)) == 0)
+                    {
+                      char *recommended =
+                        xasprintf ("Plural-Forms: %s\\n", entry->value);
+                      fprintf (stderr,
+                               _("Try using the following, valid for %s:\n"),
+                               entry->language);
+                      fprintf (stderr, "\"%s\"\n", recommended);
+                      free (recommended);
+                      break;
+                    }
+                }
            }
        }
     }
@@ -1486,9 +1491,13 @@
   else
     {
       if (check_domain)
-       po_gram_error_at_line (&gram_pos,
-                              _("`domain %s' directive ignored"), name);
-
+        {
+          /* to avoid optimization that avoids the usage of gram_pos from
+             a Win32 DLL. */
+          lex_pos_ty * volatile p_pos = &gram_pos;
+          po_gram_error_at_line (p_pos,
+                                 _("`domain %s' directive ignored"), name);
+        }
       /* NAME was allocated in po-gram-gen.y but is not used anywhere.  */
       free (name);
     }
Index: gettext-tools/src/msggrep.c
===================================================================
RCS file: /cvs/gettext/gettext/gettext-tools/src/msggrep.c,v
retrieving revision 1.24
diff -u -r1.24 msggrep.c
--- gettext-tools/src/msggrep.c 20 May 2005 21:06:04 -0000      1.24
+++ gettext-tools/src/msggrep.c 6 Jun 2005 12:44:24 -0000
@@ -80,10 +80,12 @@
 };
 static struct grep_task grep_task[3];
 
+static int tmp_line_comment = 0;
+
 /* Long options.  */
 static const struct option long_options[] =
 {
-  { "add-location", no_argument, &line_comment, 1 },
+  { "add-location", no_argument, &tmp_line_comment, 1 },
   { "comment", no_argument, NULL, 'C' },
   { "directory", required_argument, NULL, 'D' },
   { "domain", required_argument, NULL, 'M' },
@@ -99,7 +101,7 @@
   { "msgid", no_argument, NULL, 'K' },
   { "msgstr", no_argument, NULL, 'T' },
   { "no-escape", no_argument, NULL, CHAR_MAX + 3 },
-  { "no-location", no_argument, &line_comment, 0 },
+  { "no-location", no_argument, &tmp_line_comment, 0 },
   { "no-wrap", no_argument, NULL, CHAR_MAX + 6 },
   { "output-file", required_argument, NULL, 'o' },
   { "properties-input", no_argument, NULL, 'P' },
@@ -180,9 +182,13 @@
       gt->case_insensitive = false;
     }
 
+  tmp_line_comment = line_comment;
+
   while ((opt = getopt_long (argc, argv, "CD:e:Ef:FhiKM:N:o:pPTVw:",
                             long_options, NULL))
         != EOF)
+  {
+    line_comment = tmp_line_comment;
     switch (opt)
       {
       case '\0':               /* Long option.  */
@@ -364,6 +370,7 @@
        usage (EXIT_FAILURE);
        break;
       }
+  }
 
   /* Version information is requested.  */
   if (do_version)
Index: gettext-tools/src/msginit.c
===================================================================
RCS file: /cvs/gettext/gettext/gettext-tools/src/msginit.c,v
retrieving revision 1.25
diff -u -r1.25 msginit.c
--- gettext-tools/src/msginit.c 20 May 2005 21:06:04 -0000      1.25
+++ gettext-tools/src/msginit.c 6 Jun 2005 10:50:07 -0000
@@ -1374,14 +1374,24 @@
 
   /* Search for a formula depending on the catalogname.  */
   for (i = 0; i < plural_table_size; i++)
-    if (strcmp (plural_table[i].lang, catalogname) == 0)
-      return plural_table[i].value;
-
+    {
+      /* to avoid optimization that avoids the usage of gram_pos from
+         a Win32 DLL. */
+      const struct plural_table_entry * volatile entry = plural_table;
+      entry += i;
+      if (strcmp (entry->lang, catalogname) == 0)
+        return entry->value;
+    }
   /* Search for a formula depending on the language only.  */
   for (i = 0; i < plural_table_size; i++)
-    if (strcmp (plural_table[i].lang, language) == 0)
-      return plural_table[i].value;
-
+    {
+      /* to avoid optimization that avoids the usage of gram_pos from
+         a Win32 DLL. */
+      const struct plural_table_entry * volatile entry = plural_table;
+      entry += i;
+      if (strcmp (entry->lang, language) == 0)
+        return entry->value;
+    }
   return NULL;
 }
 
Index: gettext-tools/src/msgmerge.c
===================================================================
RCS file: /cvs/gettext/gettext/gettext-tools/src/msgmerge.c,v
retrieving revision 1.24
diff -u -r1.24 msgmerge.c
--- gettext-tools/src/msgmerge.c        20 May 2005 21:06:04 -0000      1.24
+++ gettext-tools/src/msgmerge.c        6 Jun 2005 12:35:20 -0000
@@ -83,10 +83,12 @@
 static const char *version_control_string;
 static const char *backup_suffix_string;
 
+static int tmp_line_comment = 0;
+
 /* Long options.  */
 static const struct option long_options[] =
 {
-  { "add-location", no_argument, &line_comment, 1 },
+  { "add-location", no_argument, &tmp_line_comment, 1 },
   { "backup", required_argument, NULL, CHAR_MAX + 1 },
   { "compendium", required_argument, NULL, 'C', },
   { "directory", required_argument, NULL, 'D' },
@@ -97,7 +99,7 @@
   { "multi-domain", no_argument, NULL, 'm' },
   { "no-escape", no_argument, NULL, 'e' },
   { "no-fuzzy-matching", no_argument, NULL, 'N' },
-  { "no-location", no_argument, &line_comment, 0 },
+  { "no-location", no_argument, &tmp_line_comment, 0 },
   { "no-wrap", no_argument, NULL, CHAR_MAX + 4 },
   { "output-file", required_argument, NULL, 'o' },
   { "properties-input", no_argument, NULL, 'P' },
@@ -173,10 +175,13 @@
   do_help = false;
   do_version = false;
   output_file = NULL;
+  tmp_line_comment = line_comment;
 
   while ((opt = getopt_long (argc, argv, "C:D:eEFhimNo:pPqsUvVw:",
                             long_options, NULL))
         != EOF)
+  {
+    line_comment = tmp_line_comment;
     switch (opt)
       {
       case '\0':               /* Long option.  */
@@ -283,11 +288,11 @@
       case CHAR_MAX + 6: /* --stringtable-output */
        message_print_syntax_stringtable ();
        break;
-
       default:
        usage (EXIT_FAILURE);
        break;
       }
+  }
 
   /* Version information is requested.  */
   if (do_version)
@@ -408,7 +413,6 @@
       /* Write the merged message list out.  */
       msgdomain_list_print (result, output_file, force_po, false);
     }
-
   exit (EXIT_SUCCESS);
 }
 
@@ -547,7 +551,6 @@
       fputs (_("Report bugs to <address@hidden>.\n"),
             stdout);
     }
-
   exit (status);
 }
 
Index: gettext-tools/src/msguniq.c
===================================================================
RCS file: /cvs/gettext/gettext/gettext-tools/src/msguniq.c,v
retrieving revision 1.12
diff -u -r1.12 msguniq.c
--- gettext-tools/src/msguniq.c 20 May 2005 21:06:04 -0000      1.12
+++ gettext-tools/src/msguniq.c 6 Jun 2005 12:44:59 -0000
@@ -51,17 +51,19 @@
 /* Target encoding.  */
 static const char *to_code;
 
+static int tmp_line_comment = 0;
+
 /* Long options.  */
 static const struct option long_options[] =
 {
-  { "add-location", no_argument, &line_comment, 1 },
+  { "add-location", no_argument, &tmp_line_comment, 1 },
   { "directory", required_argument, NULL, 'D' },
   { "escape", no_argument, NULL, 'E' },
   { "force-po", no_argument, &force_po, 1 },
   { "help", no_argument, NULL, 'h' },
   { "indent", no_argument, NULL, 'i' },
   { "no-escape", no_argument, NULL, 'e' },
-  { "no-location", no_argument, &line_comment, 0 },
+  { "no-location", no_argument, &tmp_line_comment, 0 },
   { "no-wrap", no_argument, NULL, CHAR_MAX + 2 },
   { "output-file", required_argument, NULL, 'o' },
   { "properties-input", no_argument, NULL, 'P' },
@@ -129,6 +131,8 @@
 
   while ((optchar = getopt_long (argc, argv, "dD:eEFhino:pPst:uVw:",
                                 long_options, NULL)) != EOF)
+  {
+    line_comment = tmp_line_comment;
     switch (optchar)
       {
       case '\0':               /* Long option.  */
@@ -164,7 +168,7 @@
        break;
 
       case 'n':
-       line_comment = 1;
+       tmp_line_comment = line_comment = 1;
        break;
 
       case 'o':
@@ -230,6 +234,7 @@
        usage (EXIT_FAILURE);
        /* NOTREACHED */
       }
+  }
 
   /* Version information requested.  */
   if (do_version)
Index: gettext-tools/src/xgettext.c
===================================================================
RCS file: /cvs/gettext/gettext/gettext-tools/src/xgettext.c,v
retrieving revision 1.46
diff -u -r1.46 xgettext.c
--- gettext-tools/src/xgettext.c        20 May 2005 21:06:05 -0000      1.46
+++ gettext-tools/src/xgettext.c        6 Jun 2005 12:39:22 -0000
@@ -175,11 +175,13 @@
 iconv_t xgettext_current_source_iconv;
 #endif
 
+static int tmp_line_comment = 0;
+
 /* Long options.  */
 static const struct option long_options[] =
 {
   { "add-comments", optional_argument, NULL, 'c' },
-  { "add-location", no_argument, &line_comment, 1 },
+  { "add-location", no_argument, &tmp_line_comment, 1 },
   { "c++", no_argument, NULL, 'C' },
   { "copyright-holder", required_argument, NULL, CHAR_MAX + 1 },
   { "debug", no_argument, &do_debug, 1 },
@@ -202,7 +204,7 @@
   { "msgstr-prefix", optional_argument, NULL, 'm' },
   { "msgstr-suffix", optional_argument, NULL, 'M' },
   { "no-escape", no_argument, NULL, 'e' },
-  { "no-location", no_argument, &line_comment, 0 },
+  { "no-location", no_argument, &tmp_line_comment, 0 },
   { "no-wrap", no_argument, NULL, CHAR_MAX + 4 },
   { "omit-header", no_argument, &xgettext_omit_header, 1 },
   { "output", required_argument, NULL, 'o' },
@@ -310,9 +312,13 @@
   init_flag_table_perl ();
   init_flag_table_php ();
 
+  tmp_line_comment = line_comment;
+
   while ((optchar = getopt_long (argc, argv,
                                 "ac::Cd:D:eEf:Fhijk::l:L:m::M::no:p:sTVw:x:",
                                 long_options, NULL)) != EOF)
+  {
+    line_comment = tmp_line_comment;
     switch (optchar)
       {
       case '\0':               /* Long option.  */
@@ -417,7 +423,7 @@
        msgstr_suffix = optarg == NULL ? "" : optarg;
        break;
       case 'n':
-       line_comment = 1;
+       tmp_line_comment = line_comment = 1;
        break;
       case 'o':
        output_file = optarg;
@@ -494,6 +500,7 @@
        usage (EXIT_FAILURE);
        /* NOTREACHED */
       }
+  }
 
   /* Version information requested.  */
   if (do_version)
@@ -878,7 +885,10 @@
 static void
 exclude_directive_domain (abstract_po_reader_ty *pop, char *name)
 {
-  po_gram_error_at_line (&gram_pos,
+  /* to avoid optimization that avoids the usage of gram_pos from
+     a Win32 DLL. */
+  lex_pos_ty * volatile p_pos = &gram_pos;
+  po_gram_error_at_line (p_pos,
                         _("this file may not contain domain directives"));
 }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]