vlc_common: replace last mul/add overflow usage with stdckdint.h
Maybe vlc_alloc
should be moved from vlc_common.h
to avoid that extra include.
Cc. @robUx4 @Courmisch is it breaking some cpp versions/msvc ?
Merge request reports
Activity
changed milestone to %4.0
added Component::Core label
added MRStatus::Reviewable label
50 50 #include <stdio.h> 51 51 #include <inttypes.h> 52 52 #include <stddef.h> 53 54 #ifndef __cplusplus 55 # include <stdbool.h> 56 #endif 53 #include <stdbool.h> 54 #include <stdckdint.h> If it's included here then it's not really needed in any modules.
Also the log is weird as the lines you change don't match
In file included from ../../include/vlc_common.h:56, from ../../src/test/list_cpp.cpp:28: ../../include/vlc_common.h: In function ‘void* vlc_alloc(size_t, size_t)’: ../../include/vlc_common.h:925:12: error: ‘_Bool’ was not declared in this scope 925 | return ckd_mul(&size, count, size) ? NULL : malloc(size);
_Bool
is only used if the compiler is neither GCC or Clang instdckdint.h
. If an included is needed it should be done there (or the code modified there).If it's included here then it's not really needed in any modules.
But this might change, we may want to move vlc_alloc helpers out of vlc_common.h.
_Bool is only used if the compiler is neither GCC or Clang in stdckdint.h. If an included is needed it should be done there (or the code modified there).
You mean, include
<stdbool.h>
from cpp before including<stdckdint.h>
?--- a/compat/stdckdint/stdckdint.h +++ b/compat/stdckdint/stdckdint.h @@ -25,6 +25,9 @@ # define ckd_mul(r, a, b) __builtin_mul_overflow(a, b, r) # else # include <limits.h> +# ifdef __cplusplus +# include <stdbool.h> // _Bool +# endif # define __ckd_unsigned(suffix, type, MAX) \ static inline _Bool __ckd_add_##suffix(type *r, type a, type b) \
added MRStatus::InReview label and removed MRStatus::Reviewable label