Commit 24f12823 by Volker Reichelt Committed by Volker Reichelt

init.c: Include intl.h.

2017-02-27  Volker Reichelt  <v.reichelt@netcologne.de>

       * init.c: Include intl.h.
       (build_new_1): Move message strings into pedwarn to make them
       -Wformat-security friendly. Mark string for translation.
       * pt.c (tsubst_copy_and_build): Mark string for translation.
       Make the pointer const.
       * semantics.c (finish_id_expression): Mark strings for
       * translation.

From-SVN: r245757
parent c91c3003
2017-02-27 Volker Reichelt <v.reichelt@netcologne.de>
* init.c: Include intl.h.
(build_new_1): Move message strings into pedwarn to make them
-Wformat-security friendly. Mark string for translation.
* pt.c (tsubst_copy_and_build): Mark string for translation.
Make the pointer const.
* semantics.c (finish_id_expression): Mark strings for translation.
2017-02-25 Jakub Jelinek <jakub@redhat.com> 2017-02-25 Jakub Jelinek <jakub@redhat.com>
* call.c (build_op_delete_call): Make msg1 and msg2 const. * call.c (build_op_delete_call): Make msg1 and msg2 const.
......
...@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "varasm.h" #include "varasm.h"
#include "gimplify.h" #include "gimplify.h"
#include "c-family/c-ubsan.h" #include "c-family/c-ubsan.h"
#include "intl.h"
static bool begin_init_stmts (tree *, tree *); static bool begin_init_stmts (tree *, tree *);
static tree finish_init_stmts (bool, tree, tree); static tree finish_init_stmts (bool, tree, tree);
...@@ -2803,15 +2804,12 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts, ...@@ -2803,15 +2804,12 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
{ {
if (complain & tf_warning_or_error) if (complain & tf_warning_or_error)
{ {
const char *msg; pedwarn (EXPR_LOC_OR_LOC (outer_nelts, input_location), OPT_Wvla,
if (typedef_variant_p (orig_type)) typedef_variant_p (orig_type)
msg = ("non-constant array new length must be specified " ? "non-constant array new length must be specified "
"directly, not by typedef"); "directly, not by typedef"
else : G_("non-constant array new length must be specified "
msg = ("non-constant array new length must be specified " "without parentheses around the type-id"));
"without parentheses around the type-id");
pedwarn (EXPR_LOC_OR_LOC (outer_nelts, input_location),
OPT_Wvla, msg);
} }
else else
return error_mark_node; return error_mark_node;
......
...@@ -17190,10 +17190,11 @@ tsubst_copy_and_build (tree t, ...@@ -17190,10 +17190,11 @@ tsubst_copy_and_build (tree t,
stricter. */ stricter. */
bool in_lambda = (current_class_type bool in_lambda = (current_class_type
&& LAMBDA_TYPE_P (current_class_type)); && LAMBDA_TYPE_P (current_class_type));
char const *msg = "%qD was not declared in this scope, " char const *const msg
"and no declarations were found by " = G_("%qD was not declared in this scope, "
"argument-dependent lookup at the point " "and no declarations were found by "
"of instantiation"; "argument-dependent lookup at the point "
"of instantiation");
bool diag = true; bool diag = true;
if (in_lambda) if (in_lambda)
......
...@@ -3510,7 +3510,7 @@ finish_id_expression (tree id_expression, ...@@ -3510,7 +3510,7 @@ finish_id_expression (tree id_expression,
&& DECL_CONTEXT (decl) == NULL_TREE && DECL_CONTEXT (decl) == NULL_TREE
&& !cp_unevaluated_operand) && !cp_unevaluated_operand)
{ {
*error_msg = "use of parameter outside function body"; *error_msg = G_("use of parameter outside function body");
return error_mark_node; return error_mark_node;
} }
} }
...@@ -3520,13 +3520,13 @@ finish_id_expression (tree id_expression, ...@@ -3520,13 +3520,13 @@ finish_id_expression (tree id_expression,
if (TREE_CODE (decl) == TEMPLATE_DECL if (TREE_CODE (decl) == TEMPLATE_DECL
&& !DECL_FUNCTION_TEMPLATE_P (decl)) && !DECL_FUNCTION_TEMPLATE_P (decl))
{ {
*error_msg = "missing template arguments"; *error_msg = G_("missing template arguments");
return error_mark_node; return error_mark_node;
} }
else if (TREE_CODE (decl) == TYPE_DECL else if (TREE_CODE (decl) == TYPE_DECL
|| TREE_CODE (decl) == NAMESPACE_DECL) || TREE_CODE (decl) == NAMESPACE_DECL)
{ {
*error_msg = "expected primary-expression"; *error_msg = G_("expected primary-expression");
return error_mark_node; return error_mark_node;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment