]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
build_string comments
authorJason Merrill <jason@gcc.gnu.org>
Wed, 26 Oct 2011 19:31:16 +0000 (15:31 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 26 Oct 2011 19:31:16 +0000 (15:31 -0400)
From-SVN: r180537

gcc/c-family/c-lex.c
gcc/cp/decl.c
gcc/cp/parser.c
gcc/tree.c

index baee8eb9799c5a1dea02c823831c999a769a4586..7b220abd4b8c5070931758028ac5ba2609bb5116 100644 (file)
@@ -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;
index 5ba50088684c93e4c0b32ec5ca76050e934749b9..860556c21a941c97d08b2532bffda66f440d0ed5 100644 (file)
@@ -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)
index 840a30ddf650ab84cc0cdbcd1c4ff6da23ec9ad0..090482cbd14495859672699c42c4310a16d3f150 100644 (file)
@@ -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)
 {
index 64c4968857585037f05f8a98a5ea0c52852f1ddf..2cbd68b5fd9b3c03e8e8b638823c6551a372d21a 100644 (file)
@@ -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