[PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-10 Thread Tim Northover via Phabricator via cfe-commits
t.p.northover closed this revision.
t.p.northover added a comment.

Thanks Richard, and all other reviewers. I committed this as r320250, with a 
couple of sanitizer test fixes as r320251 and r320284 (thanks Ahmed!).


Repository:
  rC Clang

https://reviews.llvm.org/D40948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-08 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

LGTM with the PS4 comment removed. Thank you!

Please also update the documentation and the release notes.




Comment at: clang/test/CodeGenCXX/vtable-available-externally.cpp:275
 struct C {
   virtual D& operator=(const D&);
 };

t.p.northover wrote:
> rsmith wrote:
> > To make this test work in C++11 onwards, you need to add a virtual move 
> > assignment operator here:
> > 
> > ```
> > virtual D& operator=(D&&);
> > ```
> That didn't quite work. The issue appears to be that D has both of those 
> implicitly defined in C++14 mode, but only the move assignment operator is 
> used below. Speculative VTable emission requires all of them to be used.
> 
> So adding a "d = d;" line to the second g function fixes the test. Does that 
> sound sane to you, or am I missing the point?
This sounds like a good approach, thanks.


Repository:
  rC Clang

https://reviews.llvm.org/D40948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-08 Thread Paul Robinson via Phabricator via cfe-commits
probinson added inline comments.



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1733
   // The PS4 uses C++11 as the default C++ standard.
-  if (T.isPS4())
-LangStd = LangStandard::lang_gnucxx11;
-  else
-LangStd = LangStandard::lang_gnucxx98;
+  LangStd = LangStandard::lang_gnucxx14;
   break;

filcab wrote:
> t.p.northover wrote:
> > filcab wrote:
> > > Why are you changing the PS4 default too?
> > Paul Robinson indicated that it was feasible back in March: 
> > http://lists.llvm.org/pipermail/cfe-dev/2017-March/052986.html. If that's 
> > changed I'd be happy to put it back to C++11, but he's one of the main 
> > people (rightly) bugging me about this so I'd be slightly surprised.
> > 
> > I also notice the comment crept back in. Bother.
> Sounds good, then. If Paul is happy with that change, I don't see a problem 
> there (assuming you do get rid of the comment for good :-) ).
> 
> Thank you,
> 
>  Filipe
Yes, PS4 product management is happy to move forward. 


Repository:
  rC Clang

https://reviews.llvm.org/D40948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-08 Thread Filipe Cabecinhas via Phabricator via cfe-commits
filcab added inline comments.



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1733
   // The PS4 uses C++11 as the default C++ standard.
-  if (T.isPS4())
-LangStd = LangStandard::lang_gnucxx11;
-  else
-LangStd = LangStandard::lang_gnucxx98;
+  LangStd = LangStandard::lang_gnucxx14;
   break;

t.p.northover wrote:
> filcab wrote:
> > Why are you changing the PS4 default too?
> Paul Robinson indicated that it was feasible back in March: 
> http://lists.llvm.org/pipermail/cfe-dev/2017-March/052986.html. If that's 
> changed I'd be happy to put it back to C++11, but he's one of the main people 
> (rightly) bugging me about this so I'd be slightly surprised.
> 
> I also notice the comment crept back in. Bother.
Sounds good, then. If Paul is happy with that change, I don't see a problem 
there (assuming you do get rid of the comment for good :-) ).

Thank you,

 Filipe


Repository:
  rC Clang

https://reviews.llvm.org/D40948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-08 Thread Tim Northover via Phabricator via cfe-commits
t.p.northover added inline comments.



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1733
   // The PS4 uses C++11 as the default C++ standard.
-  if (T.isPS4())
-LangStd = LangStandard::lang_gnucxx11;
-  else
-LangStd = LangStandard::lang_gnucxx98;
+  LangStd = LangStandard::lang_gnucxx14;
   break;

filcab wrote:
> Why are you changing the PS4 default too?
Paul Robinson indicated that it was feasible back in March: 
http://lists.llvm.org/pipermail/cfe-dev/2017-March/052986.html. If that's 
changed I'd be happy to put it back to C++11, but he's one of the main people 
(rightly) bugging me about this so I'd be slightly surprised.

I also notice the comment crept back in. Bother.


Repository:
  rC Clang

https://reviews.llvm.org/D40948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-08 Thread Filipe Cabecinhas via Phabricator via cfe-commits
filcab added inline comments.



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1733
   // The PS4 uses C++11 as the default C++ standard.
-  if (T.isPS4())
-LangStd = LangStandard::lang_gnucxx11;
-  else
-LangStd = LangStandard::lang_gnucxx98;
+  LangStd = LangStandard::lang_gnucxx14;
   break;

Why are you changing the PS4 default too?


Repository:
  rC Clang

https://reviews.llvm.org/D40948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-08 Thread Tim Northover via Phabricator via cfe-commits
t.p.northover added inline comments.



Comment at: clang/test/CodeGenCXX/new-overflow.cpp:88
   // CHECK:  [[N:%.*]] = sext i16 {{%.*}} to i32
-  // CHECK-NEXT: [[T0:%.*]] = icmp slt i32 [[N]], 0
-  // CHECK-NEXT: [[T1:%.*]] = select i1 [[T0]], i32 -1, i32 [[N]]
-  // CHECK-NEXT: call i8* @_Znaj(i32 [[T1]])
+  // CHECK-NEXT: call i8* @_Znaj(i32 [[N]])
   // CHECK:  getelementptr inbounds {{.*}}, i32 [[N]]

rsmith wrote:
> The changes in this file are a regression; C++14 requires us to check whether 
> the array bound prior to promotion is negative. Can you file a bug on that?
I've filed https://llvm.org/PR35573. Not quite sure what to do about this test 
until it's fixed though. Add a second RUN line to check both variants and then 
XFAIL it?



Comment at: clang/test/CodeGenCXX/vtable-available-externally.cpp:275
 struct C {
   virtual D& operator=(const D&);
 };

rsmith wrote:
> To make this test work in C++11 onwards, you need to add a virtual move 
> assignment operator here:
> 
> ```
> virtual D& operator=(D&&);
> ```
That didn't quite work. The issue appears to be that D has both of those 
implicitly defined in C++14 mode, but only the move assignment operator is used 
below. Speculative VTable emission requires all of them to be used.

So adding a "d = d;" line to the second g function fixes the test. Does that 
sound sane to you, or am I missing the point?



Comment at: clang/test/SemaCXX/unknown-type-name.cpp:98
 
-template int junk1(T::junk); // expected-warning{{variable 
templates are a C++14 extension}}
+template int junk1(T::junk);
+#if __cplusplus <= 201103L

rsmith wrote:
> Huh, we should probably have a `-Wvexing-parse` warning for this. Can you 
> file a bug?
I've filed https://llvm.org/PR35576. You may want to sanity check it though, I 
was pretty light on the detail because I wasn't sure of the exact diagnostic 
being proposed.


Repository:
  rC Clang

https://reviews.llvm.org/D40948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-08 Thread Tim Northover via Phabricator via cfe-commits
t.p.northover updated this revision to Diff 126129.
t.p.northover added a comment.

Updating with tentative fixes to review comments.


Repository:
  rC Clang

https://reviews.llvm.org/D40948

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGenCXX/new-overflow.cpp
  clang/test/CodeGenCXX/new.cpp
  clang/test/CodeGenCXX/vtable-available-externally.cpp
  clang/test/Lexer/cxx-features.cpp
  clang/test/Lexer/half-literal.cpp
  clang/test/OpenMP/taskloop_reduction_codegen.cpp
  clang/test/OpenMP/taskloop_simd_reduction_codegen.cpp
  clang/test/Parser/cxx1z-nested-namespace-definition.cpp
  clang/test/SemaCXX/new-array-size-conv.cpp
  clang/test/SemaCXX/new-delete.cpp
  clang/test/SemaCXX/unknown-type-name.cpp
  clang/test/SemaTemplate/class-template-decl.cpp
  clang/test/SemaTemplate/explicit-instantiation.cpp

Index: clang/test/SemaTemplate/explicit-instantiation.cpp
===
--- clang/test/SemaTemplate/explicit-instantiation.cpp
+++ clang/test/SemaTemplate/explicit-instantiation.cpp
@@ -124,10 +124,10 @@
 namespace undefined_static_data_member {
   template struct A {
 static int a; // expected-note {{here}}
-template static int b; // expected-note {{here}} expected-warning {{extension}}
+template static int b; // expected-note {{here}} expected-warning 0+ {{extension}}
   };
   struct B {
-template static int c; // expected-note {{here}} expected-warning {{extension}}
+template static int c; // expected-note {{here}} expected-warning 0+ {{extension}}
   };
 
   template int A::a; // expected-error {{explicit instantiation of undefined static data member 'a' of class template 'undefined_static_data_member::A'}}
@@ -137,14 +137,14 @@
 
   template struct C {
 static int a;
-template static int b; // expected-warning {{extension}}
+template static int b; // expected-warning 0+ {{extension}}
   };
   struct D {
-template static int c; // expected-warning {{extension}}
+template static int c; // expected-warning 0+ {{extension}}
   };
   template int C::a;
-  template template int C::b; // expected-warning {{extension}}
-  template int D::c; // expected-warning {{extension}}
+  template template int C::b; // expected-warning 0+ {{extension}}
+  template int D::c; // expected-warning 0+ {{extension}}
 
   template int C::a;
   template int C::b;
Index: clang/test/SemaTemplate/class-template-decl.cpp
===
--- clang/test/SemaTemplate/class-template-decl.cpp
+++ clang/test/SemaTemplate/class-template-decl.cpp
@@ -57,8 +57,7 @@
   template class X; // expected-error{{expression}}
 }
 
-template class X1 var; // expected-warning{{variable templates are a C++14 extension}} \
-   // expected-error {{variable has incomplete type 'class X1'}} \
+template class X1 var; // expected-error {{variable has incomplete type 'class X1'}} \
// expected-note {{forward declaration of 'X1'}}
 
 namespace M {
Index: clang/test/SemaCXX/unknown-type-name.cpp
===
--- clang/test/SemaCXX/unknown-type-name.cpp
+++ clang/test/SemaCXX/unknown-type-name.cpp
@@ -95,18 +95,23 @@
 template int h(T::type, int); // expected-error{{missing 'typename'}}
 template int h(T::type x, char); // expected-error{{missing 'typename'}}
 
-template int junk1(T::junk); // expected-warning{{variable templates are a C++14 extension}}
+template int junk1(T::junk);
+#if __cplusplus <= 201103L
+// expected-warning@-2 {{variable templates are a C++14 extension}}
+#endif
 template int junk2(T::junk) throw(); // expected-error{{missing 'typename'}}
 template int junk3(T::junk) = delete; // expected-error{{missing 'typename'}}
 #if __cplusplus <= 199711L
 //expected-warning@-2 {{deleted function definitions are a C++11 extension}}
 #endif
 
 template int junk4(T::junk j); // expected-error{{missing 'typename'}}
 
-// FIXME: We can tell this was intended to be a function because it does not
-//have a dependent nested name specifier.
-template int i(T::type, int()); // expected-warning{{variable templates are a C++14 extension}}
+template int i(T::type, int());
+#if __cplusplus <= 201103L
+// expected-warning@-2 {{variable templates are a C++14 extension}}
+#endif
+
 
 // FIXME: We know which type specifier should have been specified here. Provide
 //a fix-it to add 'typename A::type'
Index: clang/test/SemaCXX/new-delete.cpp
===
--- clang/test/SemaCXX/new-delete.cpp
+++ clang/test/SemaCXX/new-delete.cpp
@@ -80,27 +80,43 @@
   (void)new int[1.1];
 #if __cplusplus <= 199711L
   // expected-error@-2 {{array size expression must have integral or enumeration type, not 'double'}}
-#else
+#elif __cplusplus <= 201103L
   // expected-error@-4 {{array size expression must have integral or unscoped 

[PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-07 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

In https://reviews.llvm.org/D40948#948843, @t.p.northover wrote:

> Thanks Richard. I'll file the bugs tomorrow for the issues you suggest. Do 
> you see either of them blocking the change to C++14 as a default? On a scale 
> of "no", "no but I want a commitment to fix them" and "yes" sort of thing.


I don't think these should block the change of default. The //new-expression// 
one is actually a missing C++14 feature -- we're supposed to be generating a 
call to a new ABI entry point in the negative-array-bound case to throw a 
`std::bad_array_new_length` (we missed it because it's a feature added by a 
core issue rather than by a paper as I recall). I see no problem with shipping 
a Clang 6 that doesn't implement the full feature, including throwing the new 
exception. I'm not entirely happy about shipping Clang 6 without fixing the 
negative-bound check, since that means we'll generate code that is less 
hardened against certain common attacks by default, but I don't think I would 
be release-blocker-level unhappy.




Comment at: clang/test/CodeGenCXX/vtable-available-externally.cpp:1-2
-// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o %t
-// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -O2 
-disable-llvm-passes -emit-llvm -o %t.opt
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -std=c++98 -emit-llvm 
-o %t
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -std=c++98 -O2 
-disable-llvm-passes -emit-llvm -o %t.opt
 // RUN: FileCheck --check-prefix=CHECK-TEST1 %s < %t

t.p.northover wrote:
> rsmith wrote:
> > Why does this one need a -std= flag?
> It's a bit late here so I'll just give the proximal cause this evening in 
> case that makes it obvious to you. I'll dig deeper tomorrow if not.
> 
> In this particular case (without the std flag) on the -O2 run line the 
> "vtable for Test11::D" does not get marked "available_externally".
> 
> The diff on line 1 is definitely unneeded.
See comment below.



Comment at: clang/test/CodeGenCXX/vtable-available-externally.cpp:275
 struct C {
   virtual D& operator=(const D&);
 };

To make this test work in C++11 onwards, you need to add a virtual move 
assignment operator here:

```
virtual D& operator=(D&&);
```


Repository:
  rC Clang

https://reviews.llvm.org/D40948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-07 Thread Tim Northover via Phabricator via cfe-commits
t.p.northover added a comment.

Thanks Richard. I'll file the bugs tomorrow for the issues you suggest. Do you 
see either of them blocking the change to C++14 as a default? On a scale of 
"no", "no but I want a commitment to fix them" and "yes" sort of thing.

Tonight I've just got one comment that may or may not be useful context before 
I give you a proper answer tomorrow:




Comment at: clang/test/CodeGenCXX/vtable-available-externally.cpp:1-2
-// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o %t
-// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -O2 
-disable-llvm-passes -emit-llvm -o %t.opt
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -std=c++98 -emit-llvm 
-o %t
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -std=c++98 -O2 
-disable-llvm-passes -emit-llvm -o %t.opt
 // RUN: FileCheck --check-prefix=CHECK-TEST1 %s < %t

rsmith wrote:
> Why does this one need a -std= flag?
It's a bit late here so I'll just give the proximal cause this evening in case 
that makes it obvious to you. I'll dig deeper tomorrow if not.

In this particular case (without the std flag) on the -O2 run line the "vtable 
for Test11::D" does not get marked "available_externally".

The diff on line 1 is definitely unneeded.



Comment at: clang/test/Parser/cxx1z-nested-namespace-definition.cpp:3-4
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98
 // RUN: not %clang_cc1 -x c++ -fixit %t -Werror -DFIXIT
 // RUN: %clang_cc1 -x c++ %t -DFIXIT
 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17 -Wc++14-compat

rsmith wrote:
> I think these two should also be `-std=c++98`, right?
Probably; I'll convince myself of that fact tomorrow.



Comment at: clang/test/SemaCXX/unknown-type-name.cpp:110-111
 
 // FIXME: We can tell this was intended to be a function because it does not
 //have a dependent nested name specifier.
+template int i(T::type, int());

rsmith wrote:
> Maybe delete this (incorrect in C++14) FIXME?
Sounds sensible.


Repository:
  rC Clang

https://reviews.llvm.org/D40948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-07 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: clang/test/CodeGenCXX/new-overflow.cpp:88
   // CHECK:  [[N:%.*]] = sext i16 {{%.*}} to i32
-  // CHECK-NEXT: [[T0:%.*]] = icmp slt i32 [[N]], 0
-  // CHECK-NEXT: [[T1:%.*]] = select i1 [[T0]], i32 -1, i32 [[N]]
-  // CHECK-NEXT: call i8* @_Znaj(i32 [[T1]])
+  // CHECK-NEXT: call i8* @_Znaj(i32 [[N]])
   // CHECK:  getelementptr inbounds {{.*}}, i32 [[N]]

The changes in this file are a regression; C++14 requires us to check whether 
the array bound prior to promotion is negative. Can you file a bug on that?



Comment at: clang/test/CodeGenCXX/vtable-available-externally.cpp:1-2
-// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o %t
-// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -O2 
-disable-llvm-passes -emit-llvm -o %t.opt
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -std=c++98 -emit-llvm 
-o %t
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -std=c++98 -O2 
-disable-llvm-passes -emit-llvm -o %t.opt
 // RUN: FileCheck --check-prefix=CHECK-TEST1 %s < %t

Why does this one need a -std= flag?



Comment at: clang/test/Parser/cxx1z-nested-namespace-definition.cpp:3-4
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98
 // RUN: not %clang_cc1 -x c++ -fixit %t -Werror -DFIXIT
 // RUN: %clang_cc1 -x c++ %t -DFIXIT
 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17 -Wc++14-compat

I think these two should also be `-std=c++98`, right?



Comment at: clang/test/SemaCXX/unknown-type-name.cpp:98
 
-template int junk1(T::junk); // expected-warning{{variable 
templates are a C++14 extension}}
+template int junk1(T::junk);
+#if __cplusplus <= 201103L

Huh, we should probably have a `-Wvexing-parse` warning for this. Can you file 
a bug?



Comment at: clang/test/SemaCXX/unknown-type-name.cpp:110-111
 
 // FIXME: We can tell this was intended to be a function because it does not
 //have a dependent nested name specifier.
+template int i(T::type, int());

Maybe delete this (incorrect in C++14) FIXME?


Repository:
  rC Clang

https://reviews.llvm.org/D40948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-07 Thread Tim Northover via Phabricator via cfe-commits
t.p.northover added inline comments.



Comment at: clang/test/SemaCXX/new-array-size-conv.cpp:1
-// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify -std=gnu++98 %s
 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify -std=c++98 %s

probinson wrote:
> I think the intent here was "whatever the current default is" and not 
> specifically gnu++98, because the next line explicitly specifies c++98.  So, 
> unless this test fails miserably for C++14 (which I wouldn't expect) I think 
> it should be adapted to whatever gets reported for that dialect.
The original commit of this file (r107229 from Doug Gregor) called out the fact 
that what's being tested is a GNU and C++0x extension.

I think that implies that the 3 run lines really *should* test gnu++98, c++98 
and c++11.


Repository:
  rC Clang

https://reviews.llvm.org/D40948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-07 Thread Paul Robinson via Phabricator via cfe-commits
probinson added a reviewer: rjmccall.
probinson added a comment.

+rjmccall for the codegen bits.




Comment at: clang/test/SemaCXX/new-array-size-conv.cpp:1
-// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify -std=gnu++98 %s
 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify -std=c++98 %s

I think the intent here was "whatever the current default is" and not 
specifically gnu++98, because the next line explicitly specifies c++98.  So, 
unless this test fails miserably for C++14 (which I wouldn't expect) I think it 
should be adapted to whatever gets reported for that dialect.


Repository:
  rC Clang

https://reviews.llvm.org/D40948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-07 Thread Tim Northover via cfe-commits
> +  LangStd = LangStandard::lang_gnucxx14;
> 
> This comment should be removed.

Opps, yep. Fixed on my local branch. I won't upload a new diff just yet though.

Thanks.

Tim.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-07 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a reviewer: ABataev.
Hahnfeld added inline comments.



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1732
 case InputKind::ObjCXX:
   // The PS4 uses C++11 as the default C++ standard.
+  LangStd = LangStandard::lang_gnucxx14;

This comment should be removed.


Repository:
  rC Clang

https://reviews.llvm.org/D40948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-07 Thread Tim Northover via cfe-commits
Here's the test-suite diff. It's really just a few ancient code-bases
that don't compile with C++14, no runtime issues I noticed.

Tim.
commit a52b065052bfefaac17e7096fd2c911aac62e9da
Author: Tim Northover 
Date:   Thu Dec 7 09:16:34 2017 +

Support C++14 as a default in Clang

diff --git a/External/SPEC/CFP2006/447.dealII/CMakeLists.txt 
b/External/SPEC/CFP2006/447.dealII/CMakeLists.txt
index 4c3388f4..00bd711b 100644
--- a/External/SPEC/CFP2006/447.dealII/CMakeLists.txt
+++ b/External/SPEC/CFP2006/447.dealII/CMakeLists.txt
@@ -1,6 +1,7 @@
 include_directories(${BENCHMARK_DIR}/src/include)
 add_definitions(-DBOOST_DISABLE_THREADS -Ddeal_II_dimension=3)
 list(APPEND LDFLAGS -lm)
+list(APPEND CXXFLAGS -std=gnu++98)
 
 macro(verify_n run_type dir n)
   # Note that the official SPEC fp tolarence is only "-a .001", however 
this
diff --git a/External/SPEC/CFP2006/447.dealII/Makefile 
b/External/SPEC/CFP2006/447.dealII/Makefile
index 32d6d55d..ac433b55 100644
--- a/External/SPEC/CFP2006/447.dealII/Makefile
+++ b/External/SPEC/CFP2006/447.dealII/Makefile
@@ -16,7 +16,7 @@ CPPFLAGS += \
 -Ddeal_II_dimension=3 \
 -DBOOST_DISABLE_THREADS   \
 -I$(SPEC_BENCH_DIR)/src/include
-CXXFLAGS += -stdlib=libstdc++
+CXXFLAGS += -stdlib=libstdc++ -std=gnu++98
 
 STDOUT_FILENAME := log
 
diff --git a/External/SPEC/CFP2006/450.soplex/CMakeLists.txt 
b/External/SPEC/CFP2006/450.soplex/CMakeLists.txt
index f572c6bf..ffd415a5 100644
--- a/External/SPEC/CFP2006/450.soplex/CMakeLists.txt
+++ b/External/SPEC/CFP2006/450.soplex/CMakeLists.txt
@@ -1,4 +1,5 @@
 list(APPEND LDFLAGS -lm)
+list(APPEND CXXFLAGS -std=gnu++98)
 
 macro(test_input run_type input outname stdout_reltol info_reltol)
   llvm_test_run(RUN_TYPE ${run_type}
diff --git a/External/SPEC/CFP2006/450.soplex/Makefile 
b/External/SPEC/CFP2006/450.soplex/Makefile
index dcb457d4..b7de08ec 100644
--- a/External/SPEC/CFP2006/450.soplex/Makefile
+++ b/External/SPEC/CFP2006/450.soplex/Makefile
@@ -9,6 +9,7 @@ LEVEL = ../../../..
 FP_ABSTOLERANCE = 1.0e-5
 
 CPPFLAGS += -DNDEBUG
+CXXFLAGS += -std=gnu++98
 
 LDFLAGS = -lstdc++ -lm
 LIBS= -lstdc++ -lm
diff --git a/External/SPEC/CINT2006/483.xalancbmk/CMakeLists.txt 
b/External/SPEC/CINT2006/483.xalancbmk/CMakeLists.txt
index caf5ab8c..712cefbd 100644
--- a/External/SPEC/CINT2006/483.xalancbmk/CMakeLists.txt
+++ b/External/SPEC/CINT2006/483.xalancbmk/CMakeLists.txt
@@ -11,6 +11,9 @@ add_definitions(
   -DXML_USE_NATIVE_TRANSCODER
   -DXML_USE_INMEM_MESSAGELOADER
 )
+
+list(APPEND CXXFLAGS -std=gnu++98)
+
 include_directories(
   ${CMAKE_CURRENT_SOURCE_DIR}
   ${BENCHMARK_DIR}/src
diff --git a/External/SPEC/CINT2006/483.xalancbmk/Makefile 
b/External/SPEC/CINT2006/483.xalancbmk/Makefile
index 780ea3cf..2e366415 100644
--- a/External/SPEC/CINT2006/483.xalancbmk/Makefile
+++ b/External/SPEC/CINT2006/483.xalancbmk/Makefile
@@ -20,6 +20,8 @@ CPPFLAGS += -DNDEBUG -DAPP_NO_THREADS 
-DXALAN_INMEM_MSG_LOADER\
 -I$(SPEC_BENCH_DIR)/src/xercesc/util/Transcoders/Iconv\
 -I$(SPEC_BENCH_DIR)/src/xalanc/include
 
+CXXFLAGS += -std=gnu++98
+
 ifeq ($(TARGET_OS),Darwin)
   CPPFLAGS += -DSPEC_CPU_MACOSX
 endif
diff --git a/MultiSource/Benchmarks/7zip/CMakeLists.txt 
b/MultiSource/Benchmarks/7zip/CMakeLists.txt
index ee0a9ff9..9cba36f9 100644
--- a/MultiSource/Benchmarks/7zip/CMakeLists.txt
+++ b/MultiSource/Benchmarks/7zip/CMakeLists.txt
@@ -1,7 +1,7 @@
 set(PROG 7zip-benchmark)
 set(RUN_OPTIONS b)
 list(APPEND CFLAGS -DBREAK_HANDLER -DUNICODE -D_UNICODE 
-I${CMAKE_CURRENT_SOURCE_DIR}/C -I${CMAKE_CURRENT_SOURCE_DIR}/CPP/myWindows 
-I${CMAKE_CURRENT_SOURCE_DIR}/CPP/include_windows 
-I${CMAKE_CURRENT_SOURCE_DIR}/CPP -I. -D_FILE_OFFSET_BITS=64 
-D_LARGEFILE_SOURCE -DNDEBUG -D_REENTRANT -DENV_UNIX -D_7ZIP_LARGE_PAGES 
-pthread)
-list(APPEND CXXFLAGS -DBREAK_HANDLER -DUNICODE -D_UNICODE 
-I${CMAKE_CURRENT_SOURCE_DIR}/C -I${CMAKE_CURRENT_SOURCE_DIR}/CPP/myWindows 
-I${CMAKE_CURRENT_SOURCE_DIR}/CPP/include_windows 
-I${CMAKE_CURRENT_SOURCE_DIR}/CPP -I. -D_FILE_OFFSET_BITS=64 
-D_LARGEFILE_SOURCE -DNDEBUG -D_REENTRANT -DENV_UNIX -D_7ZIP_LARGE_PAGES 
-pthread)
+list(APPEND CXXFLAGS -Wno-error=c++11-narrowing -DBREAK_HANDLER -DUNICODE 
-D_UNICODE -I${CMAKE_CURRENT_SOURCE_DIR}/C 
-I${CMAKE_CURRENT_SOURCE_DIR}/CPP/myWindows 
-I${CMAKE_CURRENT_SOURCE_DIR}/CPP/include_windows 
-I${CMAKE_CURRENT_SOURCE_DIR}/CPP -I. -D_FILE_OFFSET_BITS=64 
-D_LARGEFILE_SOURCE -DNDEBUG -D_REENTRANT -DENV_UNIX -D_7ZIP_LARGE_PAGES 
-pthread)
 list(APPEND LDFLAGS -lstdc++ -pthread)
 set(Source CPP/myWindows/myGetTickCount.cpp 
CPP/myWindows/wine_date_and_time.cpp CPP/myWindows/myAddExeFlag.cpp 
CPP/myWindows/mySplitCommandLine.cpp CPP/7zip/UI/Console/BenchCon.cpp 
CPP/7zip/UI/Console/ConsoleClose.cpp 
CPP/7zip/UI/Console/ExtractCallbackConsole.cpp CPP/7zip/UI/Console/List.cpp 
CPP/7zip/UI/Console/Main.cpp CPP/7zip/UI/Console/MainAr.cpp 
CPP/7zip/UI/Console/OpenCallbackConsole.cpp 

[PATCH] D40948: Switch Clang's default C++ language target to C++14

2017-12-07 Thread Tim Northover via Phabricator via cfe-commits
t.p.northover created this revision.
Herald added a subscriber: mcrosier.

Hi all,

So, I've finally managed to run all the tests I wanted and get this out for 
review. Sorry it's taken so long. This patch switches Clang's default C++ 
target to C++14 across all platforms and updates the test-suite to pass.

I've managed to test Linux, macOS and iOS on both the regression tests and the 
test-suite (minus externals on Linux because it's my home machine). There's a 
separate patch for the test-suite which I'll attach to a follow-up message here.

I think most of the test changes are pretty straightforward and fall into a few 
broad categories:

- Changes to how the operands for "operator new" are promoted and otherwise 
wrangled in C++14. Slightly different CodeGen but essentially fine.
- Some tests explicitly testing C++ mode differences left the C++98 line 
without a -std=... argument, I added it.
- OpenMP CodeGen changes. As far as I can tell both are correct, but the tests 
are essentially unreadable so I gave up trying to adapt the output and just set 
it to C++98 mode.

I'm happy to rework anything people think needs changing.


Repository:
  rC Clang

https://reviews.llvm.org/D40948

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGenCXX/new-overflow.cpp
  clang/test/CodeGenCXX/new.cpp
  clang/test/CodeGenCXX/vtable-available-externally.cpp
  clang/test/Lexer/cxx-features.cpp
  clang/test/Lexer/half-literal.cpp
  clang/test/OpenMP/taskloop_reduction_codegen.cpp
  clang/test/OpenMP/taskloop_simd_reduction_codegen.cpp
  clang/test/Parser/cxx1z-nested-namespace-definition.cpp
  clang/test/SemaCXX/new-array-size-conv.cpp
  clang/test/SemaCXX/new-delete.cpp
  clang/test/SemaCXX/unknown-type-name.cpp
  clang/test/SemaTemplate/class-template-decl.cpp
  clang/test/SemaTemplate/explicit-instantiation.cpp

Index: clang/test/SemaTemplate/explicit-instantiation.cpp
===
--- clang/test/SemaTemplate/explicit-instantiation.cpp
+++ clang/test/SemaTemplate/explicit-instantiation.cpp
@@ -124,10 +124,10 @@
 namespace undefined_static_data_member {
   template struct A {
 static int a; // expected-note {{here}}
-template static int b; // expected-note {{here}} expected-warning {{extension}}
+template static int b; // expected-note {{here}} expected-warning 0+ {{extension}}
   };
   struct B {
-template static int c; // expected-note {{here}} expected-warning {{extension}}
+template static int c; // expected-note {{here}} expected-warning 0+ {{extension}}
   };
 
   template int A::a; // expected-error {{explicit instantiation of undefined static data member 'a' of class template 'undefined_static_data_member::A'}}
@@ -137,14 +137,14 @@
 
   template struct C {
 static int a;
-template static int b; // expected-warning {{extension}}
+template static int b; // expected-warning 0+ {{extension}}
   };
   struct D {
-template static int c; // expected-warning {{extension}}
+template static int c; // expected-warning 0+ {{extension}}
   };
   template int C::a;
-  template template int C::b; // expected-warning {{extension}}
-  template int D::c; // expected-warning {{extension}}
+  template template int C::b; // expected-warning 0+ {{extension}}
+  template int D::c; // expected-warning 0+ {{extension}}
 
   template int C::a;
   template int C::b;
Index: clang/test/SemaTemplate/class-template-decl.cpp
===
--- clang/test/SemaTemplate/class-template-decl.cpp
+++ clang/test/SemaTemplate/class-template-decl.cpp
@@ -57,8 +57,7 @@
   template class X; // expected-error{{expression}}
 }
 
-template class X1 var; // expected-warning{{variable templates are a C++14 extension}} \
-   // expected-error {{variable has incomplete type 'class X1'}} \
+template class X1 var; // expected-error {{variable has incomplete type 'class X1'}} \
// expected-note {{forward declaration of 'X1'}}
 
 namespace M {
Index: clang/test/SemaCXX/unknown-type-name.cpp
===
--- clang/test/SemaCXX/unknown-type-name.cpp
+++ clang/test/SemaCXX/unknown-type-name.cpp
@@ -95,7 +95,10 @@
 template int h(T::type, int); // expected-error{{missing 'typename'}}
 template int h(T::type x, char); // expected-error{{missing 'typename'}}
 
-template int junk1(T::junk); // expected-warning{{variable templates are a C++14 extension}}
+template int junk1(T::junk);
+#if __cplusplus <= 201103L
+// expected-warning@-2 {{variable templates are a C++14 extension}}
+#endif
 template int junk2(T::junk) throw(); // expected-error{{missing 'typename'}}
 template int junk3(T::junk) = delete; // expected-error{{missing 'typename'}}
 #if __cplusplus <= 199711L
@@ -106,7 +109,11 @@
 
 // FIXME: We can tell this was intended to be a function because it does not
 //have