1
1
# cxx11.m4 serial 6
2
- dnl Copyright (C) 2012 Reece H. Dunn
2
+ dnl Copyright (C) 2012-2015 Reece H. Dunn
3
3
dnl
4
4
dnl This file is free software; Reece H. Dunn
5
5
dnl gives unlimited permission to copy and/or distribute it,
@@ -117,7 +117,8 @@ AC_DEFUN([CXX11_NULLPTR], [
117
117
AC_COMPILE_IFELSE (
118
118
[ AC_LANG_PROGRAM (
119
119
[ [ ] ] ,
120
- [ [ const char *ptr = nullptr;] ] ) ] ,
120
+ [ [ const char *ptr = nullptr;]
121
+ [ (void)ptr;] ] ) ] ,
121
122
[ AC_MSG_RESULT ( [ yes] ) ] ,
122
123
[ AC_MSG_RESULT ( [ no] )
123
124
AC_MSG_ERROR ( [ C++11 nullptr not supported by $CXX.] ) ] )
@@ -133,8 +134,9 @@ AC_DEFUN([CXX11_DECLTYPE], [
133
134
AC_COMPILE_IFELSE (
134
135
[ AC_LANG_PROGRAM (
135
136
[ [ ] ] ,
136
- [ [ int a;]
137
- [ decltype(a) b = a;] ] ) ] ,
137
+ [ [ int a = 4;]
138
+ [ decltype(a) b = a;]
139
+ [ (void)b;] ] ) ] ,
138
140
[ AC_MSG_RESULT ( [ yes] ) ] ,
139
141
[ AC_MSG_RESULT ( [ no] )
140
142
AC_MSG_ERROR ( [ C++11 decltype not supported by $CXX.] ) ] )
@@ -151,7 +153,8 @@ AC_DEFUN([CXX11_AUTO], [
151
153
[ AC_LANG_PROGRAM (
152
154
[ [ ] ] ,
153
155
[ [ class A {} a;]
154
- [ auto b = a;] ] ) ] ,
156
+ [ auto b = a;]
157
+ [ (void)b;] ] ) ] ,
155
158
[ AC_MSG_RESULT ( [ yes] ) ] ,
156
159
[ AC_MSG_RESULT ( [ no] )
157
160
AC_MSG_ERROR ( [ C++11 auto not supported by $CXX.] ) ] )
@@ -194,7 +197,8 @@ AC_DEFUN([CXX11_BRACE_INITIALIZATION], [
194
197
[ AC_LANG_PROGRAM (
195
198
[ [ #include <complex>] ] ,
196
199
[ [ struct A { std::complex<float> c; };]
197
- [ A a { { 0.1, 0.2 } };] ] ) ] ,
200
+ [ A a { { 0.1, 0.2 } };]
201
+ [ (void)a;] ] ) ] ,
198
202
[ AC_MSG_RESULT ( [ yes] ) ] ,
199
203
[ AC_MSG_RESULT ( [ no] )
200
204
AC_MSG_ERROR ( [ C++11 brace initialization of a class in a struct not supported by $CXX.] ) ] )
@@ -231,7 +235,8 @@ AC_DEFUN([CXX11_CONSTEXPR], [
231
235
AC_MSG_CHECKING ( [ if $CXX supports C++11 constexpr] )
232
236
AC_COMPILE_IFELSE (
233
237
[ AC_LANG_PROGRAM (
234
- [ [ constexpr float value = 1.25;] ] ) ] ,
238
+ [ [ constexpr float value = 1.25;]
239
+ [ float f = value;] ] ) ] ,
235
240
[ AC_MSG_RESULT ( [ yes] ) ] ,
236
241
[ AC_MSG_RESULT ( [ no] )
237
242
AC_MSG_ERROR ( [ C++11 constexpr not supported by $CXX.] ) ] )
@@ -246,7 +251,10 @@ AC_DEFUN([CXX11_LAMBDA], [
246
251
AC_MSG_CHECKING ( [ if $CXX supports C++11 lambda] )
247
252
AC_COMPILE_IFELSE (
248
253
[ AC_LANG_PROGRAM (
249
- [ [ auto f = [ ] (int x) -> int { return x; };] ] ) ] ,
254
+ [ [ ] ] ,
255
+ [ [ auto f = [ ] (int x) -> int { return x; };]
256
+ [ int val = f(3);]
257
+ [ (void)val;] ] ) ] ,
250
258
[ AC_MSG_RESULT ( [ yes] ) ] ,
251
259
[ AC_MSG_RESULT ( [ no] )
252
260
AC_MSG_ERROR ( [ C++11 lambda not supported by $CXX.] ) ] )
@@ -257,8 +265,10 @@ AC_DEFUN([CXX11_LAMBDA_CAPTURE], [
257
265
AC_MSG_CHECKING ( [ if $CXX supports C++11 lambda captures] )
258
266
AC_COMPILE_IFELSE (
259
267
[ AC_LANG_PROGRAM (
268
+ [ [ ] ] ,
260
269
[ [ int val = 0;]
261
- [ auto f = [ &val] (int x) { val = x; };] ] ) ] ,
270
+ [ auto f = [ &val] (int x) { val = x; };]
271
+ [ f(3);] ] ) ] ,
262
272
[ AC_MSG_RESULT ( [ yes] ) ] ,
263
273
[ AC_MSG_RESULT ( [ no] )
264
274
AC_MSG_ERROR ( [ C++11 lambda captures not supported by $CXX.] ) ] )
@@ -333,7 +343,8 @@ AC_DEFUN([CXX11_HAVE_STD_BEGIN], [
333
343
[ AC_LANG_PROGRAM (
334
344
[ [ #include <iterator>] ] ,
335
345
[ [ int data[ ] = { 1, 2, 3, 4, 5 };]
336
- [ int *first = std::begin(data);] ] ) ] ,
346
+ [ int *first = std::begin(data);]
347
+ [ (void)first;] ] ) ] ,
337
348
[ AC_MSG_RESULT ( [ yes] )
338
349
AC_DEFINE ( [ HAVE_CXX11_STD_BEGIN] ,[ 1] ,[ Define to 1 if std::begin is supported.] ) ] ,
339
350
[ AC_MSG_RESULT ( [ no] ) ] )
@@ -346,7 +357,8 @@ AC_DEFUN([CXX11_REQUIRE_STD_BEGIN], [
346
357
[ AC_LANG_PROGRAM (
347
358
[ [ #include <iterator>] ] ,
348
359
[ [ int data[ ] = { 1, 2, 3, 4, 5 };]
349
- [ int *first = std::begin(data);] ] ) ] ,
360
+ [ int *first = std::begin(data);]
361
+ [ (void)first;] ] ) ] ,
350
362
[ AC_MSG_RESULT ( [ yes] ) ] ,
351
363
[ AC_MSG_RESULT ( [ no] )
352
364
AC_MSG_ERROR ( [ C++11 std::begin not supported by $CXX.] ) ] )
@@ -363,7 +375,8 @@ AC_DEFUN([CXX11_HAVE_STD_END], [
363
375
[ AC_LANG_PROGRAM (
364
376
[ [ #include <iterator>] ] ,
365
377
[ [ int data[ ] = { 1, 2, 3, 4, 5 };]
366
- [ int *last = std::end(data);] ] ) ] ,
378
+ [ int *last = std::end(data);]
379
+ [ (void)last;] ] ) ] ,
367
380
[ AC_MSG_RESULT ( [ yes] )
368
381
AC_DEFINE ( [ HAVE_CXX11_STD_END] ,[ 1] ,[ Define to 1 if std::end is supported.] ) ] ,
369
382
[ AC_MSG_RESULT ( [ no] ) ] )
@@ -376,7 +389,8 @@ AC_DEFUN([CXX11_REQUIRE_STD_END], [
376
389
[ AC_LANG_PROGRAM (
377
390
[ [ #include <iterator>] ] ,
378
391
[ [ int data[ ] = { 1, 2, 3, 4, 5 };]
379
- [ int *last = std::end(data);] ] ) ] ,
392
+ [ int *last = std::end(data);]
393
+ [ (void)last;] ] ) ] ,
380
394
[ AC_MSG_RESULT ( [ yes] ) ] ,
381
395
[ AC_MSG_RESULT ( [ no] )
382
396
AC_MSG_ERROR ( [ C++11 std::end not supported by $CXX.] ) ] )
0 commit comments