re PR c++/35878 ([LWG 2302] Useless NULL pointer check when constructing object)
authorJakub Jelinek <jakub@gcc.gnu.org>
Tue, 21 Mar 2017 07:30:48 +0000 (08:30 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 21 Mar 2017 07:30:48 +0000 (08:30 +0100)
PR c++/35878
* init.c (std_placement_new_fn_p, build_new_1): Formatting fixes.

* g++.dg/init/pr35878_1.C: Rewrite directives to scan optimized
dump instead of assembler.
* g++.dg/init/pr35878_2.C: Likewise.
* g++.dg/init/pr35878_3.C: Likewise.

From-SVN: r246303

gcc/cp/ChangeLog
gcc/cp/init.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/pr35878_1.C
gcc/testsuite/g++.dg/init/pr35878_2.C
gcc/testsuite/g++.dg/init/pr35878_3.C

index 8264502e0500d1fbf20e408c432dd19256a625bb..00dd769edd7514c6023f5bb2bb0f6e369f65d477 100644 (file)
@@ -1,7 +1,12 @@
+2017-03-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/35878
+       * init.c (std_placement_new_fn_p, build_new_1): Formatting fixes.
+
 2017-03-21  Ville Voutilainen  <ville.voutilainen@gmail.com>
 
        PR c++/35878
-       * cp/init.c (std_placement_new_fn_p): New.
+       * init.c (std_placement_new_fn_p): New.
        (build_new_1): Call it.
 
 2017-03-20  Jason Merrill  <jason@redhat.com>
index 4ec26afa23547d2be64cc416f300f13f96f53fea..773279504eeb8cbcde2788f70d40c28bb4bc3114 100644 (file)
@@ -2710,7 +2710,8 @@ malloc_alignment ()
 /* Determine whether an allocation function is a namespace-scope
    non-replaceable placement new function. See DR 1748.
    TODO: Enable in all standard modes.  */
-static bool std_placement_new_fn_p (tree alloc_fn)
+static bool
+std_placement_new_fn_p (tree alloc_fn)
 {
   if ((cxx_dialect > cxx14) && DECL_NAMESPACE_SCOPE_P (alloc_fn))
     {
@@ -3200,8 +3201,8 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
      So check for a null exception spec on the op new we just called.  */
 
   nothrow = TYPE_NOTHROW_P (TREE_TYPE (alloc_fn));
-  check_new = flag_check_new
-    || (nothrow && !std_placement_new_fn_p (alloc_fn));
+  check_new
+    = flag_check_new || (nothrow && !std_placement_new_fn_p (alloc_fn));
 
   if (cookie_size)
     {
index 79672408fe2b08bff212aa4108582968af5c68a7..c2dc55a42efd3ef75d73b56d62f1dba14a20e7ee 100644 (file)
@@ -1,3 +1,11 @@
+2017-03-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/35878
+       * g++.dg/init/pr35878_1.C: Rewrite directives to scan optimized
+       dump instead of assembler.
+       * g++.dg/init/pr35878_2.C: Likewise.
+       * g++.dg/init/pr35878_3.C: Likewise.
+
 2017-03-21  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/80097
index b45c0097a933d6827b9cf9c331aa787e1cdce7b3..e2fc4933425bcf8fd007467b535ad80c496ec9e7 100644 (file)
@@ -1,6 +1,8 @@
-// { dg-options "-O2 --std=gnu++11" }
+// PR c++/35878
 // { dg-do compile }
-// { dg-final { scan-assembler "test.*%rdi, %rdi" { target i?86-*-* x86_64-*-* } } }
+// { dg-options "-O2 -std=gnu++11 -fdump-tree-optimized" }
+// { dg-final { scan-tree-dump-times "v_\[0-9]+\\(D\\) \[=!]= 0" 1 "optimized" } }
+
 #include <new>
 #include <utility>
 
index 066449419b9e3eaddf44bde7ed1b59c28aa55e1c..c675cb6ed648d0a28baa1594b2297da3aad68234 100644 (file)
@@ -1,6 +1,8 @@
-// { dg-options "-O2 --std=gnu++17 -fcheck-new" }
+// PR c++/35878
 // { dg-do compile }
-// { dg-final { scan-assembler "test.*%rdi, %rdi" { target i?86-*-* x86_64-*-* } } }
+// { dg-options "-O2 -std=gnu++17 -fcheck-new -fdump-tree-optimized" }
+// { dg-final { scan-tree-dump-times "v_\[0-9]+\\(D\\) \[=!]= 0" 1 "optimized" } }
+
 #include <new>
 #include <utility>
 
index 8a5614f12ffc0afb31ca744351503382b2c3001e..9317ea1b231a2777b9d852098170ef9504270ca6 100644 (file)
@@ -1,6 +1,8 @@
-// { dg-options "-O2 --std=gnu++17" }
+// PR c++/35878
 // { dg-do compile }
-// { dg-final { scan-assembler-not "test.*%rdi, %rdi" { target i?86-*-* x86_64-*-* } } }
+// { dg-options "-O2 -std=gnu++17 -fdump-tree-optimized" }
+// { dg-final { scan-tree-dump-not "v_\[0-9]+\\(D\\) \[=!]= 0" "optimized" } }
+
 #include <new>
 #include <utility>