Bug 1577272 - annotate some refcounted lambda tests with expected errors for C++17; r=andi

clang produces these errors itself, but only in C++17 mode.

Differential Revision: https://phabricator.services.mozilla.com/D45611

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nathan Froyd 2019-09-12 06:40:49 +00:00
Родитель ab88be917c
Коммит 2ffed65f8f
1 изменённых файлов: 38 добавлений и 0 удалений

Просмотреть файл

@ -2,6 +2,12 @@
#define MOZ_STRONG_REF
#define MOZ_IMPLICIT __attribute__((annotate("moz_implicit")))
// Ensure that warnings about returning stack addresses of local variables are
// errors, so our `expected-error` annotations below work correctly.
#if __cplusplus >= 201703L
#pragma GCC diagnostic error "-Wreturn-stack-address"
#endif
struct RefCountedBase {
void AddRef();
void Release();
@ -394,7 +400,11 @@ void e() {
auto e1 = []() {
R* ptr;
SmartPtr<R> sp;
#if __cplusplus >= 201703L
return ([&](R* argptr) { // expected-error{{address of stack memory associated with local variable 'ptr' returned}}
#else
return ([&](R* argptr) {
#endif
R* localptr;
ptr->method();
argptr->method();
@ -404,7 +414,11 @@ void e() {
auto e2 = []() {
R* ptr;
SmartPtr<R> sp;
#if __cplusplus >= 201703L
return ([&](SmartPtr<R> argsp) { // expected-error{{address of stack memory associated with local variable 'sp' returned}}
#else
return ([&](SmartPtr<R> argsp) {
#endif
SmartPtr<R> localsp;
sp->method();
argsp->method();
@ -414,7 +428,11 @@ void e() {
auto e3 = []() {
R* ptr;
SmartPtr<R> sp;
#if __cplusplus >= 201703L
return ([&](R* argptr) { // expected-error{{address of stack memory associated with local variable 'ptr' returned}}
#else
return ([&](R* argptr) {
#endif
R* localptr;
take(ptr);
take(argptr);
@ -424,7 +442,11 @@ void e() {
auto e4 = []() {
R* ptr;
SmartPtr<R> sp;
#if __cplusplus >= 201703L
return ([&](SmartPtr<R> argsp) { // expected-error{{address of stack memory associated with local variable 'sp' returned}}
#else
return ([&](SmartPtr<R> argsp) {
#endif
SmartPtr<R> localsp;
take(sp);
take(argsp);
@ -514,7 +536,11 @@ void e() {
auto e14 = []() {
R* ptr;
SmartPtr<R> sp;
#if __cplusplus >= 201703L
return ([&ptr](R* argptr) { // expected-error{{address of stack memory associated with local variable 'ptr' returned}}
#else
return ([&ptr](R* argptr) {
#endif
R* localptr;
ptr->method();
argptr->method();
@ -524,7 +550,11 @@ void e() {
auto e15 = []() {
R* ptr;
SmartPtr<R> sp;
#if __cplusplus >= 201703L
return ([&sp](SmartPtr<R> argsp) { // expected-error{{address of stack memory associated with local variable 'sp' returned}}
#else
return ([&sp](SmartPtr<R> argsp) {
#endif
SmartPtr<R> localsp;
sp->method();
argsp->method();
@ -534,7 +564,11 @@ void e() {
auto e16 = []() {
R* ptr;
SmartPtr<R> sp;
#if __cplusplus >= 201703L
return ([&ptr](R* argptr) { // expected-error{{address of stack memory associated with local variable 'ptr' returned}}
#else
return ([&ptr](R* argptr) {
#endif
R* localptr;
take(ptr);
take(argptr);
@ -544,7 +578,11 @@ void e() {
auto e17 = []() {
R* ptr;
SmartPtr<R> sp;
#if __cplusplus >= 201703L
return ([&sp](SmartPtr<R> argsp) { // expected-error{{address of stack memory associated with local variable 'sp' returned}}
#else
return ([&sp](SmartPtr<R> argsp) {
#endif
SmartPtr<R> localsp;
take(sp);
take(argsp);