]> git.ozlabs.org Git - ccan/blob - ccan/minmax/_info
ccanlint: Move ccanlint test options from _info comments to code
[ccan] / ccan / minmax / _info
1 #include "config.h"
2 #include <stdio.h>
3 #include <string.h>
4
5 /**
6  * minmax - typesafe minimum and maximum functions
7  *
8  * The classic implementation of minimum / maximum macros in C can be
9  * very dangerous.  If the two arguments have different sizes, or
10  * different signedness, type promotion rules can lead to very
11  * surprising results.
12  *
13  * This module implements typesafe versions, which will generate a
14  * compile time error, if the arguments have different types.
15  *
16  * Example:
17  *      #include <ccan/minmax/minmax.h>
18  *      #include <stdio.h>
19  *
20  *      int main(int argc, char *argv[])
21  *      {
22  *              printf("Signed max: %d\n", max(1, -1));
23  *              printf("Unsigned max: %u\n", max(1U, -1U));
24  *              return 0;
25  *      }
26  *
27  * Author: David Gibson <david@gibson.dropbear.id.au>
28  * License:  CC0 (Public domain)
29  */
30 int main(int argc, char *argv[])
31 {
32         /* Expect exactly one argument */
33         if (argc != 2)
34                 return 1;
35
36         if (strcmp(argv[1], "depends") == 0) {
37                 printf("ccan/build_assert\n");
38                 return 0;
39         }
40
41         if (strcmp(argv[1], "ccanlint") == 0) {
42                 /* We need several gcc extensions */
43                 printf("tests_compile_without_features FAIL\n");
44                 return 0;
45         }
46
47         return 1;
48 }