]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Fix compilation error with MSVC 14 (regression 2025-12-19).
authorBruno Haible <bruno@clisp.org>
Mon, 22 Dec 2025 20:00:39 +0000 (21:00 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 22 Dec 2025 20:00:39 +0000 (21:00 +0100)
* gettext-tools/src/msgl-merge.c (match_domain): Move variable declaration out
of an OpenMP 'for' loop. Reduce scope of local variables.

gettext-tools/src/msgl-merge.c

index 02f7b702054c74bdc5c7cf240fecab0d3082b1b1..1a6585feccc2db22834be02cd24054eb9ba6b424 100644 (file)
@@ -817,20 +817,21 @@ match_domain (const char *definitions_file_name,
       XNMALLOC (refmlp->nitems, struct search_result);
     {
       long int nn = refmlp->nitems;
+      long int jj;
 
       /* Tell the OpenMP capable compiler to distribute this loop across
          several threads.  The schedule is dynamic, because for some messages
          the loop body can be executed very quickly, whereas for others it takes
          a long time.
-         Note: The Sun Workshop 6.2 C compiler does not allow a space between
-         '#' and 'pragma'.  */
+         Notes: The Sun Workshop 6.2 C compiler does not allow a space between
+         '#' and 'pragma'.  The MSVC 14 C compiler does not allow a 'for' loop
+         with a variable declaration.  */
       #ifdef _OPENMP
        #pragma omp parallel for schedule(dynamic)
       #endif
-      for (long int jj = 0; jj < nn; jj++)
+      for (jj = 0; jj < nn; jj++)
         {
           message_ty *refmsg = refmlp->item[jj];
-          message_ty *defmsg;
 
           /* Because merging can take a while we print something to signal
              we are not dead.  */
@@ -842,7 +843,7 @@ match_domain (const char *definitions_file_name,
           (*processed)++;
 
           /* See if it is in the other file.  */
-          defmsg =
+          message_ty *defmsg =
             definitions_search (definitions, refmsg->msgctxt, refmsg->msgid);
           if (defmsg != NULL)
             {