| 1 |
/* Test for printf formats: rejection of C23 formats in pedantic mode. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-std=c11 -pedantic -Wformat" } */ |
| 4 |
|
| 5 |
#include "format.h" |
| 6 |
|
| 7 |
void |
| 8 |
foo (unsigned int *uip, int_least8_t *i8, int_least16_t *i16, |
| 9 |
int_least32_t *i32, int_least64_t *i64, uint_least8_t *u8, |
| 10 |
uint_least16_t *u16, uint_least32_t *u32, uint_least64_t *u64, |
| 11 |
int_fast8_t *if8, int_fast16_t *if16, int_fast32_t *if32, |
| 12 |
int_fast64_t *if64, uint_fast8_t *uf8, uint_fast16_t *uf16, |
| 13 |
uint_fast32_t *uf32, uint_fast64_t *uf64) |
| 14 |
{ |
| 15 |
scanf ("%b", uip); /* { dg-warning "C" } */ |
| 16 |
scanf ("%w8d", i8); /* { dg-warning "C" } */ |
| 17 |
scanf ("%w16d", i16); /* { dg-warning "C" } */ |
| 18 |
scanf ("%w32d", i32); /* { dg-warning "C" } */ |
| 19 |
scanf ("%w64d", i64); /* { dg-warning "C" } */ |
| 20 |
scanf ("%wf8d", if8); /* { dg-warning "C" } */ |
| 21 |
scanf ("%wf16d", if16); /* { dg-warning "C" } */ |
| 22 |
scanf ("%wf32d", if32); /* { dg-warning "C" } */ |
| 23 |
scanf ("%wf64d", if64); /* { dg-warning "C" } */ |
| 24 |
scanf ("%w8u", u8); /* { dg-warning "C" } */ |
| 25 |
scanf ("%w16u", u16); /* { dg-warning "C" } */ |
| 26 |
scanf ("%w32u", u32); /* { dg-warning "C" } */ |
| 27 |
scanf ("%w64u", u64); /* { dg-warning "C" } */ |
| 28 |
scanf ("%wf8u", uf8); /* { dg-warning "C" } */ |
| 29 |
scanf ("%wf16u", uf16); /* { dg-warning "C" } */ |
| 30 |
scanf ("%wf32u", uf32); /* { dg-warning "C" } */ |
| 31 |
scanf ("%wf64u", uf64); /* { dg-warning "C" } */ |
| 32 |
scanf ("%w8i", i8); /* { dg-warning "C" } */ |
| 33 |
scanf ("%w8o", u8); /* { dg-warning "C" } */ |
| 34 |
scanf ("%w8x", u8); /* { dg-warning "C" } */ |
| 35 |
scanf ("%w8X", u8); /* { dg-warning "C" } */ |
| 36 |
scanf ("%w8n", i8); /* { dg-warning "C" } */ |
| 37 |
} |