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