@@ -19,77 +19,77 @@ int varargs_intval(const char c, ...) { return c; }
1919int varargs_fp (const int c , ...) {
2020 va_list arg ;
2121 va_start (arg , c );
22- char_to_int * fp = va_arg (arg , char_to_int * );
22+ char_to_int * fp = va_arg (arg , char_to_int * );
2323 return fp ((char )c );
2424}
2525
26- void entry3 (const unsigned sz , int buffer [const ])
27- {
28- int i = 0 ;
29-
30- char_to_int * p0 ;
31- char_to_int * p1 = 0 ;
32- char_to_int * p2 = intval ;
33- char_to_int * p3 = & intval ;
34- p3 = intval ;
35- p3 = & intval ;
36-
37- if (! p1 && p3 && !! p3 && p3 != 0 ) {
38- buffer [ i ] = p3 ( 'a' );
39- }
40- i ++ ;
41-
42- char_to_int_fp p4 ;
43- char_to_int_fp p5 = 0 ;
44- char_to_int_fp p6 = intval ;
45- char_to_int_fp p7 = & intval ;
46- p7 = intval ;
47- p7 = & intval ;
48-
49- if (! p5 && p7 && !! p7 && p7 != 0 ) {
50- buffer [ i ] = ( * p7 )( 'a' );
51- }
52- i ++ ;
53-
54- char_to_int_fp funs [ 3 ] = { intval , negintval };
55-
56- for ( int j = 0 ; funs [j ]; j ++ ) {
57- buffer [ i ++ ] = funs [ j ] ? funs [ j ]( 'a' + j ) : 55 ;
58- }
59-
60- // validate function pointer comparison to null
61- buffer [i ++ ] = p1 = = 0 ;
62- buffer [i ++ ] = p1 ! = 0 ;
63- buffer [i ++ ] = p2 = = 0 ;
64- buffer [ i ++ ] = p2 != 0 ;
65-
66- // These should now use is_some, is_none:
67- int j = p4 == 0 ;
68- j = 0 == p4 ;
69- j = p4 != 0 ;
70- j = 0 != p4 ;
71-
72- va_char_to_int_fp p8 = varargs_intval ;
73- buffer [i ++ ] = p8 ( 'A ' );
74- buffer [ i ++ ] = ( * p8 )( 'B' , 'C' );
75-
76- // Test valid casts between function pointers
77- // with additional parameters
78- char_int_to_int_fp p9 = ( char_int_to_int_fp ) & intval , p10 = (char_int_to_int_fp )p7 ;
79- buffer [i ++ ] = p9 ('D' , 42 );
80- buffer [i ++ ] = p10 ('E' , 1337 );
81-
82- // Test K&R style function pointers
83- knr * p11 = (knr * )1 ;
84- knr * p12 = (knr * )intval ;
85- knr * p13 = (knr * )& intval ;
86- struct pointer_st s ;
87- s .fn = (int (* )())intval ;
88- buffer [i ++ ] = p12 ('a' );
89- buffer [i ++ ] = p13 ('a' );
90- buffer [i ++ ] = (* (s ).fn )(('a' ));
91-
92- buffer [i ++ ] = p2 == intval ;
93- buffer [i ++ ] = varargs_fp ('a' , intval );
94- buffer [i ++ ] = varargs_fp ('b' , p2 );
26+ void entry3 (const unsigned sz , int buffer [const ]) {
27+ int i = 0 ;
28+
29+ char_to_int * p0 ;
30+ char_to_int * p1 = 0 ;
31+ char_to_int * p2 = intval ;
32+ char_to_int * p3 = & intval ;
33+ p3 = intval ;
34+ p3 = & intval ;
35+
36+ if (! p1 && p3 && !! p3 && p3 != 0 ) {
37+ buffer [ i ] = p3 ( 'a' );
38+ }
39+ i ++ ;
40+
41+ char_to_int_fp p4 ;
42+ char_to_int_fp p5 = 0 ;
43+ char_to_int_fp p6 = intval ;
44+ char_to_int_fp p7 = & intval ;
45+ p7 = intval ;
46+ p7 = & intval ;
47+
48+ if (! p5 && p7 && !! p7 && p7 != 0 ) {
49+ buffer [ i ] = ( * p7 )( 'a' );
50+ }
51+ i ++ ;
52+
53+ char_to_int_fp funs [ 3 ] = { intval , negintval };
54+
55+ for ( int j = 0 ; funs [ j ]; j ++ ) {
56+ buffer [ i ++ ] = funs [ j ] ? funs [j ]( 'a' + j ) : 55 ;
57+ }
58+
59+ // validate function pointer comparison to null
60+ buffer [ i ++ ] = p1 == 0 ;
61+ buffer [i ++ ] = p1 ! = 0 ;
62+ buffer [i ++ ] = p2 = = 0 ;
63+ buffer [i ++ ] = p2 ! = 0 ;
64+
65+ // These should now use is_some, is_none:
66+ int j = p4 == 0 ;
67+ j = 0 == p4 ;
68+ j = p4 != 0 ;
69+ j = 0 != p4 ;
70+
71+ va_char_to_int_fp p8 = varargs_intval ;
72+ buffer [ i ++ ] = p8 ( 'A' ) ;
73+ buffer [i ++ ] = ( * p8 )( 'B' , 'C ' );
74+
75+ // Test valid casts between function pointers
76+ // with additional parameters
77+ char_int_to_int_fp p9 = ( char_int_to_int_fp ) & intval ,
78+ p10 = (char_int_to_int_fp )p7 ;
79+ buffer [i ++ ] = p9 ('D' , 42 );
80+ buffer [i ++ ] = p10 ('E' , 1337 );
81+
82+ // Test K&R style function pointers
83+ knr * p11 = (knr * )1 ;
84+ knr * p12 = (knr * )intval ;
85+ knr * p13 = (knr * )& intval ;
86+ struct pointer_st s ;
87+ s .fn = (int (* )())intval ;
88+ buffer [i ++ ] = p12 ('a' );
89+ buffer [i ++ ] = p13 ('a' );
90+ buffer [i ++ ] = (* (s ).fn )(('a' ));
91+
92+ buffer [i ++ ] = p2 == intval ;
93+ buffer [i ++ ] = varargs_fp ('a' , intval );
94+ buffer [i ++ ] = varargs_fp ('b' , p2 );
9595}
0 commit comments