summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/wtr-suffix-1.c
blob: ed0b40ecf301dd83bac522d2213ee0cc33b10c21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Test for -Wtraditional warnings on integer constant suffixes.
   Note, gcc should omit these warnings in system header files.
   Origin: Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/24/2000.  */
/* { dg-do compile } */
/* { dg-options "-Wtraditional" } */

void
testfunc ()
{
  int i;
  double f;

  i = 1L;
  i = 1l;
  i = 1U; /* { dg-warning "traditional C rejects" "numeric constant suffix" } */
  i = 1u; /* { dg-warning "traditional C rejects" "numeric constant suffix" } */
  f = 1.0;
  f = 1.0F; /* { dg-warning "traditional C rejects" "numeric constant suffix" } */
  f = 1.0f; /* { dg-warning "traditional C rejects" "numeric constant suffix" } */
  f = 1.0L; /* { dg-warning "traditional C rejects" "numeric constant suffix" } */
  f = 1.0l; /* { dg-warning "traditional C rejects" "numeric constant suffix" } */
 
# 24 "sys-header.h" 3
/* We are in system headers now, no -Wtraditional warnings should issue.  */

  i = 1L;
  i = 1l;
  i = 1U;
  i = 1u;
  f = 1.0;
  f = 1.0F;
  f = 1.0f;
  f = 1.0L;
  f = 1.0l;
}