diff options
author | Jason Merrill <jason@gcc.gnu.org> | 2011-10-26 15:31:16 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-10-26 15:31:16 -0400 |
commit | 1ca3916f5688863f49976febd57b1a9640d1c71a (patch) | |
tree | 21ade8d4825d9024836e5cce7f12ddde0032b6c9 | |
parent | 3ce4f9e4d2643273f11647e97b2c7796a64a73dd (diff) | |
download | gcc-1ca3916f5688863f49976febd57b1a9640d1c71a.zip gcc-1ca3916f5688863f49976febd57b1a9640d1c71a.tar.gz gcc-1ca3916f5688863f49976febd57b1a9640d1c71a.tar.bz2 |
build_string comments
From-SVN: r180537
-rw-r--r-- | gcc/c-family/c-lex.c | 2 | ||||
-rw-r--r-- | gcc/cp/decl.c | 2 | ||||
-rw-r--r-- | gcc/cp/parser.c | 1 | ||||
-rw-r--r-- | gcc/tree.c | 1 |
4 files changed, 5 insertions, 1 deletions
diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index baee8eb..7b220ab 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -344,6 +344,8 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags, { tree suffix_id = get_identifier (suffix); int len = tok->val.str.len - strlen (suffix); + /* If this is going to be used as a C string to pass to a + raw literal operator, we need to add a trailing NUL. */ tree num_string = build_string (len + 1, (const char *) tok->val.str.text); TREE_TYPE (num_string) = char_array_type_node; diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 5ba5008..860556c 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8592,7 +8592,7 @@ grokdeclarator (const cp_declarator *declarator, error ("declaration of %qD as non-function", dname); return error_mark_node; } - + if (dname && TREE_CODE (dname) == IDENTIFIER_NODE && UDLIT_OPER_P (dname) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 840a30d..090482c 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -3667,6 +3667,7 @@ cp_parser_userdef_numeric_literal (cp_parser *parser) /* Parse a user-defined string constant. Returns a call to a user-defined literal operator taking a character pointer and the length of the string as arguments. */ + static tree cp_parser_userdef_string_literal (cp_token *token) { @@ -1525,6 +1525,7 @@ build_real_from_int_cst (tree type, const_tree i) /* Return a newly constructed STRING_CST node whose value is the LEN characters at STR. + Note that for a C string literal, LEN should include the trailing NUL. The TREE_TYPE is not initialized. */ tree |