Norman James | 6a58a27 | 2015-10-07 14:34:16 -0500 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | #include <string.h> |
| 3 | #include "config.h" |
| 4 | |
| 5 | /** |
| 6 | * check_type - routines for compile time type checking |
| 7 | * |
| 8 | * C has fairly weak typing: ints get automatically converted to longs, signed |
| 9 | * to unsigned, etc. There are some cases where this is best avoided, and |
| 10 | * these macros provide methods for evoking warnings (or build errors) when |
| 11 | * a precise type isn't used. |
| 12 | * |
| 13 | * On compilers which don't support typeof() these routines are less effective, |
| 14 | * since they have to use sizeof() which can only distiguish between types of |
| 15 | * different size. |
| 16 | * |
| 17 | * License: CC0 (Public domain) |
| 18 | * Author: Rusty Russell <rusty@rustcorp.com.au> |
| 19 | */ |
| 20 | int main(int argc, char *argv[]) |
| 21 | { |
| 22 | if (argc != 2) |
| 23 | return 1; |
| 24 | |
| 25 | if (strcmp(argv[1], "depends") == 0) { |
| 26 | #if !HAVE_TYPEOF |
| 27 | printf("ccan/build_assert\n"); |
| 28 | #endif |
| 29 | return 0; |
| 30 | } |
| 31 | |
| 32 | return 1; |
| 33 | } |