rmlint icon indicating copy to clipboard operation
rmlint copied to clipboard

fix undefined macros

Open cebtenzzre opened this issue 2 years ago • 0 comments

The worst of them were an undefined UINTPTR_MAX in RM_PLATFORM_*, which could both be false and caused a stat struct to be mis-casted in traverse.c, and a non-macro HASHER_FADVISE_FLAGS that made rm_hasher_request_readahead a no-op since commit 31cd32f1.

Also add a static assert in the usual ADD_FILE to make sure it never casts between incompatible stat structs, and -Werror=undef so we don't allow undefined macros to silently evaluate to zero.

The UINTPTR_MAX issue is a regression caused by 90edf021, which removed the inttypes.h include in config.h.in.

Fixes #549


Here's the preprocessor condition that wasn't working: https://github.com/sahib/rmlint/blob/bdb591f4bc124fad6da1035ffb2b513826e9d64f/lib/traverse.c#L215

Here's the definition of RM_PLATFORM_32: https://github.com/sahib/rmlint/blob/bdb591f4bc124fad6da1035ffb2b513826e9d64f/lib/config.h.in#L60

stdint.h was not being included in either config.h or traverse.c, so UINTPTR_MAX was undefined and (by default) silently evaluates to zero. Note that this PR brings back rm_hasher_request_readahead for the first time in over 6 years, which I haven't thoroughly tested (but is most likely fine).

cebtenzzre avatar Jan 24 '22 23:01 cebtenzzre