diff options
| author | Alistair Popple <alistair@popple.id.au> | 2016-01-07 16:19:43 +1100 |
|---|---|---|
| committer | Alistair Popple <alistair@popple.id.au> | 2016-01-11 18:51:07 +1100 |
| commit | 4c3473a4785336103cc47de95fddbbba12b12e7a (patch) | |
| tree | 06c8c19e6c8494e8dc9695bec8bc7c446d930d95 /ccan/array_size/_info | |
| download | pdbg-4c3473a4785336103cc47de95fddbbba12b12e7a.tar.gz pdbg-4c3473a4785336103cc47de95fddbbba12b12e7a.zip | |
Initial release of pdbg
pdbg is a tool to access P8 host registers and memory from the BMC for
kernel and firmware debugging purposes.
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Diffstat (limited to 'ccan/array_size/_info')
| -rw-r--r-- | ccan/array_size/_info | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/ccan/array_size/_info b/ccan/array_size/_info new file mode 100644 index 0000000..d670042 --- /dev/null +++ b/ccan/array_size/_info @@ -0,0 +1,46 @@ +#include <stdio.h> +#include <string.h> +#include "config.h" + +/** + * array_size - routine for safely deriving the size of a visible array. + * + * This provides a simple ARRAY_SIZE() macro, which (given a good compiler) + * will also break compile if you try to use it on a pointer. + * + * This can ensure your code is robust to changes, without needing a gratuitous + * macro or constant. + * + * Example: + * // Outputs "Initialized 32 values" + * #include <ccan/array_size/array_size.h> + * #include <stdlib.h> + * #include <stdio.h> + * + * // We currently use 32 random values. + * static unsigned int vals[32]; + * + * int main(void) + * { + * unsigned int i; + * for (i = 0; i < ARRAY_SIZE(vals); i++) + * vals[i] = random(); + * printf("Initialized %u values\n", i); + * return 0; + * } + * + * License: CC0 (Public domain) + * Author: Rusty Russell <rusty@rustcorp.com.au> + */ +int main(int argc, char *argv[]) +{ + if (argc != 2) + return 1; + + if (strcmp(argv[1], "depends") == 0) { + printf("ccan/build_assert\n"); + return 0; + } + + return 1; +} |

