| 1 |
// RUN: rm -fR %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
// RUN: %clang_cc1 -fsyntax-only -verify=c99 -std=c99 %t/floatneeds0.c |
| 4 |
// RUN: %clang_cc1 -fsyntax-only -verify=c99 -std=c99 %t/floatneeds1.c |
| 5 |
// RUN: %clang_cc1 -fsyntax-only -verify=c23 -std=c23 %t/floatneeds0.c |
| 6 |
// RUN: %clang_cc1 -fsyntax-only -verify=c23 -std=c23 %t/floatneeds1.c |
| 7 |
// RUN: %clang_cc1 -fsyntax-only -verify=c99-modules -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -std=c99 %t/floatneeds0.c |
| 8 |
// RUN: %clang_cc1 -fsyntax-only -verify=c99-modules -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -std=c99 %t/floatneeds1.c |
| 9 |
// RUN: %clang_cc1 -fsyntax-only -verify=c23-modules -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -std=c23 %t/floatneeds0.c |
| 10 |
// RUN: %clang_cc1 -fsyntax-only -verify=c23-modules -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -std=c23 %t/floatneeds1.c |
| 11 |
|
| 12 |
// Use C99 to verify that __need_ can be used to get types that wouldn't normally be available. |
| 13 |
|
| 14 |
//--- floatneeds0.c |
| 15 |
float infinity0 = INFINITY; // c99-error{{undeclared identifier 'INFINITY'}} c23-error{{undeclared identifier 'INFINITY'}} \ |
| 16 |
c99-modules-error{{undeclared identifier 'INFINITY'}} c23-modules-error{{undeclared identifier 'INFINITY'}} |
| 17 |
float nan0 = NAN; // c99-error{{undeclared identifier 'NAN'}} c23-error{{undeclared identifier 'NAN'}} \ |
| 18 |
c99-modules-error{{undeclared identifier 'NAN'}} c23-modules-error{{undeclared identifier 'NAN'}} |
| 19 |
float max0 = FLT_MAX; // c99-error{{undeclared identifier 'FLT_MAX'}} c23-error{{undeclared identifier 'FLT_MAX'}} \ |
| 20 |
c99-modules-error{{undeclared identifier 'FLT_MAX'}} c23-modules-error{{undeclared identifier 'FLT_MAX'}} |
| 21 |
|
| 22 |
#define __need_infinity_nan |
| 23 |
#include <float.h> |
| 24 |
float infinity1 = INFINITY; |
| 25 |
float nan1 = NAN; |
| 26 |
float max1 = FLT_MAX; // c99-error{{undeclared identifier}} c23-error{{undeclared identifier}} \ |
| 27 |
c99-modules-error{{undeclared identifier}} c23-modules-error{{undeclared identifier}} |
| 28 |
|
| 29 |
#include <float.h> |
| 30 |
float infinity2 = INFINITY; |
| 31 |
float nan2 = NAN; |
| 32 |
float max2 = FLT_MAX; |
| 33 |
|
| 34 |
//--- floatneeds1.c |
| 35 |
// c23-no-diagnostics |
| 36 |
// c23-modules-no-diagnostics |
| 37 |
|
| 38 |
#include <float.h> |
| 39 |
float infinity0 = INFINITY; // c99-error{{undeclared identifier}} c99-modules-error{{undeclared identifier}} |
| 40 |
float nan0 = NAN; // c99-error{{undeclared identifier}} c99-modules-error{{undeclared identifier}} |
| 41 |
float max0 = FLT_MAX; |