File: check-static-type-checking.c

package info (click to toggle)
frame 2.5.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,540 kB
  • sloc: sh: 11,090; cpp: 3,815; ansic: 745; makefile: 288
file content (29 lines) | stat: -rw-r--r-- 827 bytes parent folder | download | duplicates (3)
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
/* Simple test to verify that an impossible type passed into a
 * frame_*_get_property() function does not compile. Due to the nature of
 * compile tests, we do not test all combinations of types and functions. This
 * test is merely to check that the improper type mechanism is working at all.
 */

#include <oif/frame.h>

#ifdef __has_extension
#if __has_extension(c_generic_selections)
#define HAS_C_GENERIC_SELECTIONS
#endif // __has_extension(c_generic_selections)
#endif // __has_extension

int main() {

#ifdef HAS_C_GENERIC_SELECTIONS
  UFStatus status;
  UFTouch touch;
  char test;

  /* No touch properties are of type 'char', this should fail to compile */
  status = frame_touch_get_property(touch, UFTouchPropertyId, &test);
#else
#error PASS: C compiler does not support generic selections
#endif

  return 0;
}