Bug 114364 - Untranslatable string 'in intervening code'
Summary: Untranslatable string 'in intervening code'
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 14.0
: P3 normal
Target Milestone: ---
Assignee: Jakub Jelinek
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2024-03-16 15:28 UTC by Roland Illig
Modified: 2024-03-19 08:20 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2024-03-16 00:00:00


Attachments
gcc14-pr1164364.patch (1.29 KB, patch)
2024-03-16 16:00 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Illig 2024-03-16 15:28:59 UTC
From c-family/c-omp.cc:
>      error_at (LOCATION_OR (eloc, loc),
>		"variable %qD used %s is bound "
>		"in intervening code", bad, context);

As a translator, I have no chance of translating 'in intervening code'. Sentence fragments must not be embedded using %s, as other natural languages differ structurally.
Comment 1 Roland Illig 2024-03-16 15:32:39 UTC
Oops, I misinterpreted the code, as 'in intervening code' is indeed translatable, but 'as loop variable' isn't, so the bug report is still valid.
Comment 2 Jakub Jelinek 2024-03-16 16:00:18 UTC
Created attachment 57716 [details]
gcc14-pr1164364.patch

Untested fix.
Comment 3 Roland Illig 2024-03-17 21:45:32 UTC
The diff looks good to me. Untested.
Comment 4 GCC Commits 2024-03-19 08:13:20 UTC
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:8959ab63f1881a8a4b1921b946d4ea3986bf1063

commit r14-9534-g8959ab63f1881a8a4b1921b946d4ea3986bf1063
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Mar 19 09:10:26 2024 +0100

    openmp: Make c_omp_check_loop_binding_exprs diagnostics translatable [PR114364]
    
    c_omp_check_loop_binding_exprs with check_loop_binding_expr was composing
    diagnostics from a format string with %s that provided additional words (but not
    keywords).  That is a big no no for translations, both because the translator
    can't choose a different word order and because the %s part wasn't translated
    at all (would need to use _("...") to get translated), so this patch rewrites it
    such that the whole messages are in the format strings.
    
    2024-03-19  Jakub Jelinek  <jakub@redhat.com>
    
            PR c/114364
            * c-omp.cc (enum check_loop_binding_expr_ctx): New type.
            (check_loop_binding_expr): Remove context argument, add ctx
            argument with check_loop_binding_expr_ctx type at the end.  Don't
            create diagnostic message from multiple pieces.
            (c_omp_check_loop_binding_exprs): Adjust callers.
Comment 5 Jakub Jelinek 2024-03-19 08:20:28 UTC
Fixed.