On Fri, 5 Sep 2025, Jakub Jelinek wrote:
> Hi!
>
> I've noticed a lot of diagnostic messages in the C FE aren't marked
> for translation.
> The reason is some weird coding style which wraps the string
> literals into (), especially when they don't fit on a single line.
> With that fixed, there were 83 unique similar messages
> "both %<something%> and %<something%> in declaration specifiers"
> marked for translation, which is very unfriendly to translators,
> the patch brings that down to 4 (if it was ok to change order,
> it could be even 3):
> msgid "both %qs and %qs in declaration specifiers"
> msgid "both %qs and %<__int%d%> in declaration specifiers"
> msgid "both %qs and %<_Float%d%s%> in declaration specifiers"
> msgid "both %<__int%d%> and %qs in declaration specifiers"
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
OK.
> --- gcc/c/c-parser.cc.jj 2025-08-27 10:20:32.362413128 +0200
> +++ gcc/c/c-parser.cc 2025-09-04 10:07:10.749514998 +0200
> @@ -30173,10 +30173,12 @@ c_parser_transaction (c_parser *parser,
> if (flag_tm)
> stmt = c_finish_transaction (loc, stmt, this_in);
> else
> - error_at (loc, (keyword == RID_TRANSACTION_ATOMIC ?
> - "%<__transaction_atomic%> without transactional memory support enabled"
> - : "%<__transaction_relaxed %> "
> - "without transactional memory support enabled"));
> + error_at (loc,
> + keyword == RID_TRANSACTION_ATOMIC
> + ? G_("%<__transaction_atomic%> without transactional memory "
> + "support enabled")
> + : G_("%<__transaction_relaxed %> without transactional memory "
> + "support enabled"));
>
> return stmt;
> }
> @@ -30240,10 +30242,12 @@ c_parser_transaction_expression (c_parse
> parser->in_transaction = old_in;
>
> if (!flag_tm)
> - error_at (loc, (keyword == RID_TRANSACTION_ATOMIC ?
> - "%<__transaction_atomic%> without transactional memory support enabled"
> - : "%<__transaction_relaxed %> "
> - "without transactional memory support enabled"));
> + error_at (loc,
> + keyword == RID_TRANSACTION_ATOMIC
> + ? G_("%<__transaction_atomic%> without transactional memory "
> + "support enabled")
> + : G_("%<__transaction_relaxed %> without transactional memory "
> + "support enabled"));
Pre-existing condition: the space before '%>' looks wrong in these
messages.
--
Joseph S. Myers
[email protected]