• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple i686-pc-linux-gnu -analyze -analyzer-checker=security.insecureAPI,security.FloatLoopCounter %s -verify
2 // expected-no-diagnostics
3 
4 // This file complements 'security-syntax-checks.m', but tests that we omit
5 // specific checks on platforms where they don't make sense.
6 
7 // Omit the 'rand' check since 'arc4random' is not available on Linux.
8 int      rand(void);
9 double   drand48(void);
10 double   erand48(unsigned short[3]);
11 long     jrand48(unsigned short[3]);
12 void     lcong48(unsigned short[7]);
13 long     lrand48(void);
14 long     mrand48(void);
15 long     nrand48(unsigned short[3]);
16 long     random(void);
17 int      rand_r(unsigned *);
18 
test_rand()19 void test_rand()
20 {
21   unsigned short a[7];
22   unsigned b;
23 
24   rand();	// no-warning
25   drand48();	// no-warning
26   erand48(a);	// no-warning
27   jrand48(a);	// no-warning
28   lcong48(a);	// no-warning
29   lrand48();	// no-warning
30   mrand48();	// no-warning
31   nrand48(a);	// no-warning
32   rand_r(&b);	// no-warning
33   random();	// no-warning
34 }
35