Pebble Foundation Classes
0.2.0
C++ for Pebble
pebble_warn_unsupported_functions.h
1
/* This file provides clear error messages when developer
2
* attempts to use a function call supported by newlib-c but
3
* not provided by the pebble libraries.
4
*
5
* ex. use of fopen("test.txt", "r") will display...
6
* src/main.c:123:3 error: static assertion failed: "fopen() is not supported"
7
*/
8
9
// Rather than asserting on printf,
10
// lets map it to app_log for simple cross-compiles
11
#define printf(format, ...) \
12
app_log(APP_LOG_LEVEL_DEBUG, __FILE_NAME__, __LINE__, format, ##__VA_ARGS__)
13
14
// List of unsupported file io calls
15
#define fopen(...) _Static_assert(0, "fopen() is not supported")
16
#define fclose(...) _Static_assert(0, "fclose() is not supported")
17
#define fread(...) _Static_assert(0, "fread() is not supported")
18
#define fwrite(...) _Static_assert(0, "fwrite() is not supported")
19
#define fseek(...) _Static_assert(0, "fseek() is not supported")
20
#define ftell(...) _Static_assert(0, "ftell() is not supported")
21
#define fsetpos(...) _Static_assert(0, "fsetpos() is not supported")
22
#define fscanf(...) _Static_assert(0, "fscanf() is not supported")
23
#define fgetc(...) _Static_assert(0, "fgetc() is not supported")
24
#define fgets(...) _Static_assert(0, "fgets() is not supported")
25
#define fputc(...) _Static_assert(0, "fputc() is not supported")
26
#define fputs(...) _Static_assert(0, "fputs() is not supported")
27
28
// List of unsupported print calls
29
#define fprintf(...) _Static_assert(0, "fprintf() is not supported")
30
#define sprintf(...) _Static_assert(0, "sprintf() is not supported")
31
#define vfprintf(...) _Static_assert(0, "vfprintf() is not supported")
32
#define vsprintf(...) _Static_assert(0, "vsprintf() is not supported")
33
#define vsnprintf(...) _Static_assert(0, "vsnprintf() is not supported")
34
35
// List of unsupported io calls
36
#define open(...) _Static_assert(0, "open() is not supported")
37
#define close(...) _Static_assert(0, "close() is not supported")
38
#define creat(...) _Static_assert(0, "creat() is not supported")
39
#define read(...) _Static_assert(0, "read() is not supported")
40
#define write(...) _Static_assert(0, "write() is not supported")
41
#define stat(...) _Static_assert(0, "stat() is not supported")
42
43
// List of unsupported memory calls
44
#define alloca(...) _Static_assert(0, "alloca() is not supported")
45
#define mmap(...) _Static_assert(0, "mmap() is not supported")
46
#define brk(...) _Static_assert(0, "brk() is not supported")
47
#define sbrk(...) _Static_assert(0, "sbrk() is not supported")
48
sdk_include
pebble_warn_unsupported_functions.h
Generated by
1.8.17