Compare commits

..

2 Commits

Author SHA1 Message Date
17e140f235 br.h: add __unused and __used macros 2022-12-18 14:22:18 +01:00
a1e436babc C: remove dead code in 2022/day 9 2022-12-17 18:50:10 +01:00
2 changed files with 11 additions and 22 deletions

View File

@@ -186,28 +186,6 @@ static int parse()
return count; return count;
} }
/*
* static int solve(int part)
* {
* ulong bucket;
* dir_t *cur;
* int res = 0, needed;
*
* if (part == 1) {
* hash_for_each(hasht_dir, bucket, cur, hlist)
* if (cur->size <= 100000)
* res += cur->size;
* } else {
* res = find_dirname("/", 1)->size;
* needed = res - (70000000-30000000);
* hash_for_each(hasht_dir, bucket, cur, hlist)
* if (cur->size >= needed && cur->size < res)
* res = cur->size;
* }
* return res;
* }
*/
int main(int ac, char **av) int main(int ac, char **av)
{ {
int part = parseargs(ac, av); int part = parseargs(ac, av);

View File

@@ -31,6 +31,17 @@
#define __PASTE(x, y) ___PASTE(x, y) #define __PASTE(x, y) ___PASTE(x, y)
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
/* unused/used parameters/functions
* https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-unused-function-attribute
* https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-unused-type-attribute
* https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-unused-variable-attribute
* https://gcc.gnu.org/onlinedocs/gcc/Label-Attributes.html#index-unused-label-attribute
* https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-used-function-attribute
* https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-used-variable-attribute
*/
#define __unused __attribute__((__unused__))
#define __used __attribute__((__used__))
/* see https://lkml.org/lkml/2018/3/20/845 for explanation of this monster /* see https://lkml.org/lkml/2018/3/20/845 for explanation of this monster
*/ */
#define __is_constexpr(x) \ #define __is_constexpr(x) \