* [PATCH v2 0/4] kbuild: remove gcc's -Wtype-limits
@ 2025-12-19 22:39 Vincent Mailhol
2025-12-19 22:39 ` [PATCH v2 1/4] " Vincent Mailhol
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Vincent Mailhol @ 2025-12-19 22:39 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier, Nick Desaulniers,
Bill Wendling, Justin Stitt, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Chris Mason,
David Sterba, Kees Cook, Gustavo A. R. Silva
Cc: Linus Torvalds, linux-kbuild, linux-sparse, linux-kernel, llvm,
dri-devel, linux-btrfs, linux-hardening, Vincent Mailhol
I often read on the mailing list people saying "who cares about W=2
builds anyway?". At least I do. Not that I want to fix all of them,
but on some occasions, such as new driver submissions, I have often
found a couple valid diagnostics in the W=2 output.
That said, the annoying thing is that W=2 is heavily polluted by one
warning: -Wtype-limits. Try a gcc W=2 build on any file and see the
results for yourself. I suspect this to be the reason why so few
people are using W=2.
This series removes gcc's -Wtype-limits in an attempt to make W=2 more
useful. Those who do not use W=2 can continue to not use it if they
want. Those who, like me, use it for time to time will get an improved
experience from the reduced spam.
Patch #1 deactivates -Wtype-limits. Extra details on statistics, past
attempts and alternatives are given in the description.
Patch #2 clean-ups the local kbuild -Wno-type-limits exceptions,
patches #3 and #4 undo some of the local workarounds which silenced
that warning by uglifying the code.
Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
---
Changes in v2:
- Add two more patches to clean up some -Wtype-limits workarounds
- Collect the Reviewed-by tags.
Link to v1: https://lore.kernel.org/r/20251218-remove_wtype-limits-v1-0-735417536787@kernel.org
---
Vincent Mailhol (4):
kbuild: remove gcc's -Wtype-limits
kbuild: cleanup local -Wno-type-limits exceptions
overflow: Remove is_non_negative() and is_negative()
minmax: remove useless cast in __is_nonneg()
drivers/gpu/drm/Makefile | 1 -
fs/btrfs/Makefile | 1 -
include/linux/minmax.h | 5 +----
include/linux/overflow.h | 10 ++--------
scripts/Makefile.warn | 4 +++-
5 files changed, 6 insertions(+), 15 deletions(-)
---
base-commit: 3e7f562e20ee87a25e104ef4fce557d39d62fa85
change-id: 20251205-remove_wtype-limits-c77eb46d09c2
Best regards,
--
Vincent Mailhol <mailhol@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v2 1/4] kbuild: remove gcc's -Wtype-limits 2025-12-19 22:39 [PATCH v2 0/4] kbuild: remove gcc's -Wtype-limits Vincent Mailhol @ 2025-12-19 22:39 ` Vincent Mailhol 2025-12-19 22:39 ` [PATCH v2 2/4] kbuild: cleanup local -Wno-type-limits exceptions Vincent Mailhol ` (2 subsequent siblings) 3 siblings, 0 replies; 8+ messages in thread From: Vincent Mailhol @ 2025-12-19 22:39 UTC (permalink / raw) To: Nathan Chancellor, Nicolas Schier, Nick Desaulniers, Bill Wendling, Justin Stitt, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter, Chris Mason, David Sterba, Kees Cook, Gustavo A. R. Silva Cc: Linus Torvalds, linux-kbuild, linux-sparse, linux-kernel, llvm, dri-devel, linux-btrfs, linux-hardening, Vincent Mailhol W=2 builds are heavily polluted by the -Wtype-limits warning. Here are some W=12 statistics on Linux v6.19-rc1 for an x86_64 defconfig (with just CONFIG_WERROR set to "n") using gcc 14.3.1: Warning name count percent ------------------------------------------------- -Wlogical-op 2 0.00 % -Wmaybe-uninitialized 138 0.20 % -Wunused-macros 869 1.24 % -Wmissing-field-initializers 1418 2.02 % -Wshadow 2234 3.19 % -Wtype-limits 65378 93.35 % ------------------------------------------------- Total 70039 100.00 % As we can see, -Wtype-limits represents the vast majority of all warnings. The reason behind this is that these warnings appear in some common header files, meaning that some unique warnings are repeated tens of thousands of times (once per header inclusion). Add to this the fact that each warning is coupled with a dozen lines detailing some macro expansion. The end result is that the W=2 output is just too bloated and painful to use. Three years ago, I proposed in [1] modifying one such header to silence that noise. Because the code was not faulty, Linus rejected the idea and instead suggested simply removing that warning. At that time, I could not bring myself to send such a patch because, despite its problems, -Wtype-limits would still catch the below bug: unsigned int ret; ret = check(); if (ret < 0) error(); Meanwhile, based on another suggestion from Linus, I added a new check to sparse [2] that would catch the above bug without the useless spam. With this, remove gcc's -Wtype-limits. People who still want to catch incorrect comparisons between unsigned integers and zero can now use sparse instead. On a side note, clang also has a -Wtype-limits warning but: * it is not enabled in the kernel at the moment because, contrary to gcc, clang did not include it under -Wextra. * it does not warn if the code results from a macro expansion. So, if activated, it would not cause as much spam as gcc does. * -Wtype-limits is split into four sub-warnings [3] meaning that if it were to be activated, we could select which one to keep. So there is no present need to explicitly disable -Wtype-limits in clang. [1] linux/bits.h: GENMASK_INPUT_CHECK: reduce W=2 noise by 31% treewide Link: https://lore.kernel.org/all/20220308141201.2343757-1-mailhol.vincent@wanadoo.fr/ [2] Warn about "unsigned value that used to be signed against zero" Link: https://lore.kernel.org/all/20250921061337.3047616-1-mailhol@kernel.org/ [3] clang's -Wtype-limits Link: https://clang.llvm.org/docs/DiagnosticsReference.html#wtype-limits Reviewed-by: Nicolas Schier <nsc@kernel.org> Signed-off-by: Vincent Mailhol <mailhol@kernel.org> --- scripts/Makefile.warn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.warn b/scripts/Makefile.warn index 68e6fafcb80c..c593ab1257de 100644 --- a/scripts/Makefile.warn +++ b/scripts/Makefile.warn @@ -55,6 +55,9 @@ else KBUILD_CFLAGS += -Wno-main endif +# Too noisy on range checks and in macros handling both signed and unsigned. +KBUILD_CFLAGS += -Wno-type-limits + # These result in bogus false positives KBUILD_CFLAGS += $(call cc-option, -Wno-dangling-pointer) @@ -174,7 +177,6 @@ else # The following turn off the warnings enabled by -Wextra KBUILD_CFLAGS += -Wno-missing-field-initializers -KBUILD_CFLAGS += -Wno-type-limits KBUILD_CFLAGS += -Wno-shift-negative-value ifdef CONFIG_CC_IS_CLANG -- 2.51.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/4] kbuild: cleanup local -Wno-type-limits exceptions 2025-12-19 22:39 [PATCH v2 0/4] kbuild: remove gcc's -Wtype-limits Vincent Mailhol 2025-12-19 22:39 ` [PATCH v2 1/4] " Vincent Mailhol @ 2025-12-19 22:39 ` Vincent Mailhol 2025-12-19 22:39 ` [PATCH v2 3/4] overflow: Remove is_non_negative() and is_negative() Vincent Mailhol 2025-12-19 22:39 ` [PATCH v2 4/4] minmax: remove useless cast in __is_nonneg() Vincent Mailhol 3 siblings, 0 replies; 8+ messages in thread From: Vincent Mailhol @ 2025-12-19 22:39 UTC (permalink / raw) To: Nathan Chancellor, Nicolas Schier, Nick Desaulniers, Bill Wendling, Justin Stitt, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter, Chris Mason, David Sterba, Kees Cook, Gustavo A. R. Silva Cc: Linus Torvalds, linux-kbuild, linux-sparse, linux-kernel, llvm, dri-devel, linux-btrfs, linux-hardening, Vincent Mailhol Now that -Wtype-limits is globally deactivated, there is no need for local exceptions anymore. Acked-by: David Sterba <dsterba@suse.com> Signed-off-by: Vincent Mailhol <mailhol@kernel.org> --- Changelog: v1 -> v2: small change in patch description --- drivers/gpu/drm/Makefile | 1 - fs/btrfs/Makefile | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 0e1c668b46d2..b879a60ca79a 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -22,7 +22,6 @@ subdir-ccflags-y += $(call cc-option, -Wstringop-truncation) # The following turn off the warnings enabled by -Wextra ifeq ($(findstring 2, $(KBUILD_EXTRA_WARN)),) subdir-ccflags-y += -Wno-missing-field-initializers -subdir-ccflags-y += -Wno-type-limits subdir-ccflags-y += -Wno-shift-negative-value endif ifeq ($(findstring 3, $(KBUILD_EXTRA_WARN)),) diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile index 743d7677b175..40bc2f7e6f6b 100644 --- a/fs/btrfs/Makefile +++ b/fs/btrfs/Makefile @@ -17,7 +17,6 @@ subdir-ccflags-y += $(condflags) # The following turn off the warnings enabled by -Wextra subdir-ccflags-y += -Wno-missing-field-initializers subdir-ccflags-y += -Wno-sign-compare -subdir-ccflags-y += -Wno-type-limits subdir-ccflags-y += -Wno-shift-negative-value obj-$(CONFIG_BTRFS_FS) := btrfs.o -- 2.51.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/4] overflow: Remove is_non_negative() and is_negative() 2025-12-19 22:39 [PATCH v2 0/4] kbuild: remove gcc's -Wtype-limits Vincent Mailhol 2025-12-19 22:39 ` [PATCH v2 1/4] " Vincent Mailhol 2025-12-19 22:39 ` [PATCH v2 2/4] kbuild: cleanup local -Wno-type-limits exceptions Vincent Mailhol @ 2025-12-19 22:39 ` Vincent Mailhol 2025-12-19 22:39 ` [PATCH v2 4/4] minmax: remove useless cast in __is_nonneg() Vincent Mailhol 3 siblings, 0 replies; 8+ messages in thread From: Vincent Mailhol @ 2025-12-19 22:39 UTC (permalink / raw) To: Nathan Chancellor, Nicolas Schier, Nick Desaulniers, Bill Wendling, Justin Stitt, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter, Chris Mason, David Sterba, Kees Cook, Gustavo A. R. Silva Cc: Linus Torvalds, linux-kbuild, linux-sparse, linux-kernel, llvm, dri-devel, linux-btrfs, linux-hardening, Vincent Mailhol The is_non_negative() and is_negative() function-like macros just exist as a workaround to silence the -Wtype-limits warning. Now that this warning is disabled, those two macros have lost their raison d'être. Remove them. This reverts commit dc7fe518b049 ("overflow: Fix -Wtype-limits compilation warnings"). Suggested-by: Nicolas Schier <nsc@kernel.org> Link: https://lore.kernel.org/all/aUT_yWin_xslnOFh@derry.ads.avm.de Signed-off-by: Vincent Mailhol <mailhol@kernel.org> --- Changelog: v1 -> v2: new patch --- include/linux/overflow.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/include/linux/overflow.h b/include/linux/overflow.h index 736f633b2d5f..ab142d60c6b5 100644 --- a/include/linux/overflow.h +++ b/include/linux/overflow.h @@ -36,12 +36,6 @@ #define __type_min(T) ((T)((T)-type_max(T)-(T)1)) #define type_min(t) __type_min(typeof(t)) -/* - * Avoids triggering -Wtype-limits compilation warning, - * while using unsigned data types to check a < 0. - */ -#define is_non_negative(a) ((a) > 0 || (a) == 0) -#define is_negative(a) (!(is_non_negative(a))) /* * Allows for effectively applying __must_check to a macro so we can have @@ -201,9 +195,9 @@ static inline bool __must_check __must_check_overflow(bool overflow) typeof(d) _d = d; \ unsigned long long _a_full = _a; \ unsigned int _to_shift = \ - is_non_negative(_s) && _s < 8 * sizeof(*d) ? _s : 0; \ + _s >= 0 && _s < 8 * sizeof(*d) ? _s : 0; \ *_d = (_a_full << _to_shift); \ - (_to_shift != _s || is_negative(*_d) || is_negative(_a) || \ + (_to_shift != _s || *_d < 0 || _a < 0 || \ (*_d >> _to_shift) != _a); \ })) -- 2.51.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 4/4] minmax: remove useless cast in __is_nonneg() 2025-12-19 22:39 [PATCH v2 0/4] kbuild: remove gcc's -Wtype-limits Vincent Mailhol ` (2 preceding siblings ...) 2025-12-19 22:39 ` [PATCH v2 3/4] overflow: Remove is_non_negative() and is_negative() Vincent Mailhol @ 2025-12-19 22:39 ` Vincent Mailhol 2025-12-20 10:02 ` David Laight 2025-12-20 12:03 ` kernel test robot 3 siblings, 2 replies; 8+ messages in thread From: Vincent Mailhol @ 2025-12-19 22:39 UTC (permalink / raw) To: Nathan Chancellor, Nicolas Schier, Nick Desaulniers, Bill Wendling, Justin Stitt, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter, Chris Mason, David Sterba, Kees Cook, Gustavo A. R. Silva Cc: Linus Torvalds, linux-kbuild, linux-sparse, linux-kernel, llvm, dri-devel, linux-btrfs, linux-hardening, Vincent Mailhol The function like macro __is_nonneg() casts its argument to (long long) in an attempt to silence -Wtype-limits warnings on unsigned values. But this workaround is incomplete as proven here: $ cat foo.c #include <linux/minmax.h> int foo(unsigned int a) { return __is_nonneg(a); } $ make CFLAGS_KERNEL="-Wtype-limits" foo.o CALL scripts/checksyscalls.sh DESCEND objtool INSTALL libsubcmd_headers CC foo.o foo.c: In function 'foo': ./include/linux/minmax.h:68:57: warning: comparison is always true due to limited range of data type [-Wtype-limits] 68 | #define __is_nonneg(ux) statically_true((long long)(ux) >= 0) | ^~ ./include/linux/compiler.h:350:50: note: in definition of macro 'statically_true' 350 | #define statically_true(x) (__builtin_constant_p(x) && (x)) | ^ foo.c:5:16: note: in expansion of macro '__is_nonneg' 5 | return __is_nonneg(a); | ^~~~~~~~~~~ ./include/linux/minmax.h:68:57: warning: comparison is always true due to limited range of data type [-Wtype-limits] 68 | #define __is_nonneg(ux) statically_true((long long)(ux) >= 0) | ^~ ./include/linux/compiler.h:350:57: note: in definition of macro 'statically_true' 350 | #define statically_true(x) (__builtin_constant_p(x) && (x)) | ^ foo.c:5:16: note: in expansion of macro '__is_nonneg' 5 | return __is_nonneg(a); | ^~~~~~~~~~~ And because -Wtype-limits is now globally disabled, such a workaround now becomes useless. Remove the __is_nonneg()'s cast and its related comment. Signed-off-by: Vincent Mailhol <mailhol@kernel.org> --- Changelog: v1 -> v2: new patch --- include/linux/minmax.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/linux/minmax.h b/include/linux/minmax.h index a0158db54a04..3e2e3e539ba1 100644 --- a/include/linux/minmax.h +++ b/include/linux/minmax.h @@ -52,9 +52,6 @@ /* * Check whether a signed value is always non-negative. * - * A cast is needed to avoid any warnings from values that aren't signed - * integer types (in which case the result doesn't matter). - * * On 64-bit any integer or pointer type can safely be cast to 'long long'. * But on 32-bit we need to avoid warnings about casting pointers to integers * of different sizes without truncating 64-bit values so 'long' or 'long long' @@ -65,7 +62,7 @@ * but they are handled by the !is_signed_type() case). */ #if __SIZEOF_POINTER__ == __SIZEOF_LONG_LONG__ -#define __is_nonneg(ux) statically_true((long long)(ux) >= 0) +#define __is_nonneg(ux) statically_true((ux) >= 0) #else #define __is_nonneg(ux) statically_true( \ (typeof(__builtin_choose_expr(sizeof(ux) > 4, 1LL, 1L)))(ux) >= 0) -- 2.51.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 4/4] minmax: remove useless cast in __is_nonneg() 2025-12-19 22:39 ` [PATCH v2 4/4] minmax: remove useless cast in __is_nonneg() Vincent Mailhol @ 2025-12-20 10:02 ` David Laight 2025-12-20 10:53 ` Vincent Mailhol 2025-12-20 12:03 ` kernel test robot 1 sibling, 1 reply; 8+ messages in thread From: David Laight @ 2025-12-20 10:02 UTC (permalink / raw) To: Vincent Mailhol Cc: Nathan Chancellor, Nicolas Schier, Nick Desaulniers, Bill Wendling, Justin Stitt, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter, Chris Mason, David Sterba, Kees Cook, Gustavo A. R. Silva, Linus Torvalds, linux-kbuild, linux-sparse, linux-kernel, llvm, dri-devel, linux-btrfs, linux-hardening On Fri, 19 Dec 2025 23:39:48 +0100 Vincent Mailhol <mailhol@kernel.org> wrote: > The function like macro __is_nonneg() casts its argument to (long long) > in an attempt to silence -Wtype-limits warnings on unsigned values. nak. The cast is needed for pointer types, not for -Wtype-limits. which is why the '#if __SIZEOF_POINTER__ == __SIZEOF_LONG_LONG__' test is there. David > > But this workaround is incomplete as proven here: > > $ cat foo.c > #include <linux/minmax.h> > > int foo(unsigned int a) > { > return __is_nonneg(a); > } > $ make CFLAGS_KERNEL="-Wtype-limits" foo.o > CALL scripts/checksyscalls.sh > DESCEND objtool > INSTALL libsubcmd_headers > CC foo.o > foo.c: In function 'foo': > ./include/linux/minmax.h:68:57: warning: comparison is always true due to limited range of data type [-Wtype-limits] > 68 | #define __is_nonneg(ux) statically_true((long long)(ux) >= 0) > | ^~ > ./include/linux/compiler.h:350:50: note: in definition of macro 'statically_true' > 350 | #define statically_true(x) (__builtin_constant_p(x) && (x)) > | ^ > foo.c:5:16: note: in expansion of macro '__is_nonneg' > 5 | return __is_nonneg(a); > | ^~~~~~~~~~~ > ./include/linux/minmax.h:68:57: warning: comparison is always true due to limited range of data type [-Wtype-limits] > 68 | #define __is_nonneg(ux) statically_true((long long)(ux) >= 0) > | ^~ > ./include/linux/compiler.h:350:57: note: in definition of macro 'statically_true' > 350 | #define statically_true(x) (__builtin_constant_p(x) && (x)) > | ^ > foo.c:5:16: note: in expansion of macro '__is_nonneg' > 5 | return __is_nonneg(a); > | ^~~~~~~~~~~ > > And because -Wtype-limits is now globally disabled, such a workaround > now becomes useless. Remove the __is_nonneg()'s cast and its related > comment. > > Signed-off-by: Vincent Mailhol <mailhol@kernel.org> > --- > Changelog: > > v1 -> v2: new patch > --- > include/linux/minmax.h | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/include/linux/minmax.h b/include/linux/minmax.h > index a0158db54a04..3e2e3e539ba1 100644 > --- a/include/linux/minmax.h > +++ b/include/linux/minmax.h > @@ -52,9 +52,6 @@ > /* > * Check whether a signed value is always non-negative. > * > - * A cast is needed to avoid any warnings from values that aren't signed > - * integer types (in which case the result doesn't matter). > - * > * On 64-bit any integer or pointer type can safely be cast to 'long long'. > * But on 32-bit we need to avoid warnings about casting pointers to integers > * of different sizes without truncating 64-bit values so 'long' or 'long long' > @@ -65,7 +62,7 @@ > * but they are handled by the !is_signed_type() case). > */ > #if __SIZEOF_POINTER__ == __SIZEOF_LONG_LONG__ > -#define __is_nonneg(ux) statically_true((long long)(ux) >= 0) > +#define __is_nonneg(ux) statically_true((ux) >= 0) > #else > #define __is_nonneg(ux) statically_true( \ > (typeof(__builtin_choose_expr(sizeof(ux) > 4, 1LL, 1L)))(ux) >= 0) > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 4/4] minmax: remove useless cast in __is_nonneg() 2025-12-20 10:02 ` David Laight @ 2025-12-20 10:53 ` Vincent Mailhol 0 siblings, 0 replies; 8+ messages in thread From: Vincent Mailhol @ 2025-12-20 10:53 UTC (permalink / raw) To: David Laight Cc: Nathan Chancellor, Nicolas Schier, Nick Desaulniers, Bill Wendling, Justin Stitt, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter, Chris Mason, David Sterba, Kees Cook, Gustavo A. R. Silva, Linus Torvalds, linux-kbuild, linux-sparse, linux-kernel, llvm, dri-devel, linux-btrfs, linux-hardening On 20/12/2025 at 11:02, David Laight wrote: > On Fri, 19 Dec 2025 23:39:48 +0100 > Vincent Mailhol <mailhol@kernel.org> wrote: > >> The function like macro __is_nonneg() casts its argument to (long long) >> in an attempt to silence -Wtype-limits warnings on unsigned values. > > nak. > > The cast is needed for pointer types, not for -Wtype-limits. > which is why the '#if __SIZEOF_POINTER__ == __SIZEOF_LONG_LONG__' > test is there. OK. I will remove that fourth patch in v3. Yours sincerely, Vincent Mailhol ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 4/4] minmax: remove useless cast in __is_nonneg() 2025-12-19 22:39 ` [PATCH v2 4/4] minmax: remove useless cast in __is_nonneg() Vincent Mailhol 2025-12-20 10:02 ` David Laight @ 2025-12-20 12:03 ` kernel test robot 1 sibling, 0 replies; 8+ messages in thread From: kernel test robot @ 2025-12-20 12:03 UTC (permalink / raw) To: Vincent Mailhol, Nathan Chancellor, Nicolas Schier, Nick Desaulniers, Bill Wendling, Justin Stitt, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter, Chris Mason, David Sterba, Kees Cook, Gustavo A. R. Silva Cc: oe-kbuild-all, linux-kbuild, linux-sparse, linux-kernel, llvm, dri-devel, linux-btrfs, linux-hardening, Vincent Mailhol Hi Vincent, kernel test robot noticed the following build warnings: [auto build test WARNING on 3e7f562e20ee87a25e104ef4fce557d39d62fa85] url: https://github.com/intel-lab-lkp/linux/commits/Vincent-Mailhol/kbuild-remove-gcc-s-Wtype-limits/20251220-064204 base: 3e7f562e20ee87a25e104ef4fce557d39d62fa85 patch link: https://lore.kernel.org/r/20251219-remove_wtype-limits-v2-4-2e92b3f566c5%40kernel.org patch subject: [PATCH v2 4/4] minmax: remove useless cast in __is_nonneg() config: x86_64-rhel-9.4-ltp (https://download.01.org/0day-ci/archive/20251220/202512201303.je0bERQn-lkp@intel.com/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251220/202512201303.je0bERQn-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202512201303.je0bERQn-lkp@intel.com/ All warnings (new ones prefixed by >>): In file included from <command-line>: lib/lzo/lzo1x_compress.c: In function 'lzo1x_1_do_compress': >> include/linux/minmax.h:65:46: warning: ordered comparison of pointer with integer zero [-Wextra] 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~ include/linux/compiler_types.h:610:23: note: in definition of macro '__compiletime_assert' 610 | if (!(condition)) \ | ^~~~~~~~~ include/linux/compiler_types.h:630:9: note: in expansion of macro '_compiletime_assert' 630 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:90:9: note: in expansion of macro 'BUILD_BUG_ON_MSG' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~~~~~~~ include/linux/minmax.h:65:25: note: in expansion of macro 'statically_true' 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~~~~~~~~~~~~~~ include/linux/minmax.h:50:14: note: in expansion of macro '__is_nonneg' 50 | (2 + __is_nonneg(ux)) : (1 + 2 * (sizeof(ux) < 4))) | ^~~~~~~~~~~ include/linux/minmax.h:72:10: note: in expansion of macro '__sign_use' 72 | (__sign_use(ux) & __sign_use(uy)) | ^~~~~~~~~~ include/linux/minmax.h:90:27: note: in expansion of macro '__types_ok' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~ include/linux/minmax.h:95:9: note: in expansion of macro '__careful_cmp_once' 95 | __careful_cmp_once(op, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:102:25: note: in expansion of macro '__careful_cmp' 102 | #define min(x, y) __careful_cmp(min, x, y) | ^~~~~~~~~~~~~ lib/lzo/lzo1x_compress.c:65:54: note: in expansion of macro 'min' 65 | const unsigned char *limit = min(ip_end, ip + MAX_ZERO_RUN_LENGTH + 1); | ^~~ >> include/linux/minmax.h:65:46: warning: ordered comparison of pointer with integer zero [-Wextra] 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~ include/linux/compiler_types.h:610:23: note: in definition of macro '__compiletime_assert' 610 | if (!(condition)) \ | ^~~~~~~~~ include/linux/compiler_types.h:630:9: note: in expansion of macro '_compiletime_assert' 630 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:90:9: note: in expansion of macro 'BUILD_BUG_ON_MSG' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~~~~~~~ include/linux/minmax.h:65:25: note: in expansion of macro 'statically_true' 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~~~~~~~~~~~~~~ include/linux/minmax.h:50:14: note: in expansion of macro '__is_nonneg' 50 | (2 + __is_nonneg(ux)) : (1 + 2 * (sizeof(ux) < 4))) | ^~~~~~~~~~~ include/linux/minmax.h:72:10: note: in expansion of macro '__sign_use' 72 | (__sign_use(ux) & __sign_use(uy)) | ^~~~~~~~~~ include/linux/minmax.h:90:27: note: in expansion of macro '__types_ok' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~ include/linux/minmax.h:95:9: note: in expansion of macro '__careful_cmp_once' 95 | __careful_cmp_once(op, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:102:25: note: in expansion of macro '__careful_cmp' 102 | #define min(x, y) __careful_cmp(min, x, y) | ^~~~~~~~~~~~~ lib/lzo/lzo1x_compress.c:65:54: note: in expansion of macro 'min' 65 | const unsigned char *limit = min(ip_end, ip + MAX_ZERO_RUN_LENGTH + 1); | ^~~ >> include/linux/minmax.h:65:46: warning: ordered comparison of pointer with integer zero [-Wextra] 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~ include/linux/compiler_types.h:610:23: note: in definition of macro '__compiletime_assert' 610 | if (!(condition)) \ | ^~~~~~~~~ include/linux/compiler_types.h:630:9: note: in expansion of macro '_compiletime_assert' 630 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:90:9: note: in expansion of macro 'BUILD_BUG_ON_MSG' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~~~~~~~ include/linux/minmax.h:65:25: note: in expansion of macro 'statically_true' 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~~~~~~~~~~~~~~ include/linux/minmax.h:50:14: note: in expansion of macro '__is_nonneg' 50 | (2 + __is_nonneg(ux)) : (1 + 2 * (sizeof(ux) < 4))) | ^~~~~~~~~~~ include/linux/minmax.h:72:27: note: in expansion of macro '__sign_use' 72 | (__sign_use(ux) & __sign_use(uy)) | ^~~~~~~~~~ include/linux/minmax.h:90:27: note: in expansion of macro '__types_ok' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~ include/linux/minmax.h:95:9: note: in expansion of macro '__careful_cmp_once' 95 | __careful_cmp_once(op, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:102:25: note: in expansion of macro '__careful_cmp' 102 | #define min(x, y) __careful_cmp(min, x, y) | ^~~~~~~~~~~~~ lib/lzo/lzo1x_compress.c:65:54: note: in expansion of macro 'min' 65 | const unsigned char *limit = min(ip_end, ip + MAX_ZERO_RUN_LENGTH + 1); | ^~~ >> include/linux/minmax.h:65:46: warning: ordered comparison of pointer with integer zero [-Wextra] 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~ include/linux/compiler_types.h:610:23: note: in definition of macro '__compiletime_assert' 610 | if (!(condition)) \ | ^~~~~~~~~ include/linux/compiler_types.h:630:9: note: in expansion of macro '_compiletime_assert' 630 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:90:9: note: in expansion of macro 'BUILD_BUG_ON_MSG' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~~~~~~~ include/linux/minmax.h:65:25: note: in expansion of macro 'statically_true' 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~~~~~~~~~~~~~~ include/linux/minmax.h:50:14: note: in expansion of macro '__is_nonneg' 50 | (2 + __is_nonneg(ux)) : (1 + 2 * (sizeof(ux) < 4))) | ^~~~~~~~~~~ include/linux/minmax.h:72:27: note: in expansion of macro '__sign_use' 72 | (__sign_use(ux) & __sign_use(uy)) | ^~~~~~~~~~ include/linux/minmax.h:90:27: note: in expansion of macro '__types_ok' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~ include/linux/minmax.h:95:9: note: in expansion of macro '__careful_cmp_once' 95 | __careful_cmp_once(op, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:102:25: note: in expansion of macro '__careful_cmp' 102 | #define min(x, y) __careful_cmp(min, x, y) | ^~~~~~~~~~~~~ lib/lzo/lzo1x_compress.c:65:54: note: in expansion of macro 'min' 65 | const unsigned char *limit = min(ip_end, ip + MAX_ZERO_RUN_LENGTH + 1); | ^~~ -- In file included from <command-line>: lib/lzo/lzo1x_compress.c: In function 'lzo1x_1_do_compress_safe': >> include/linux/minmax.h:65:46: warning: ordered comparison of pointer with integer zero [-Wextra] 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~ include/linux/compiler_types.h:610:23: note: in definition of macro '__compiletime_assert' 610 | if (!(condition)) \ | ^~~~~~~~~ include/linux/compiler_types.h:630:9: note: in expansion of macro '_compiletime_assert' 630 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:90:9: note: in expansion of macro 'BUILD_BUG_ON_MSG' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~~~~~~~ include/linux/minmax.h:65:25: note: in expansion of macro 'statically_true' 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~~~~~~~~~~~~~~ include/linux/minmax.h:50:14: note: in expansion of macro '__is_nonneg' 50 | (2 + __is_nonneg(ux)) : (1 + 2 * (sizeof(ux) < 4))) | ^~~~~~~~~~~ include/linux/minmax.h:72:10: note: in expansion of macro '__sign_use' 72 | (__sign_use(ux) & __sign_use(uy)) | ^~~~~~~~~~ include/linux/minmax.h:90:27: note: in expansion of macro '__types_ok' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~ include/linux/minmax.h:95:9: note: in expansion of macro '__careful_cmp_once' 95 | __careful_cmp_once(op, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:102:25: note: in expansion of macro '__careful_cmp' 102 | #define min(x, y) __careful_cmp(min, x, y) | ^~~~~~~~~~~~~ lib/lzo/lzo1x_compress.c:65:54: note: in expansion of macro 'min' 65 | const unsigned char *limit = min(ip_end, ip + MAX_ZERO_RUN_LENGTH + 1); | ^~~ >> include/linux/minmax.h:65:46: warning: ordered comparison of pointer with integer zero [-Wextra] 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~ include/linux/compiler_types.h:610:23: note: in definition of macro '__compiletime_assert' 610 | if (!(condition)) \ | ^~~~~~~~~ include/linux/compiler_types.h:630:9: note: in expansion of macro '_compiletime_assert' 630 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:90:9: note: in expansion of macro 'BUILD_BUG_ON_MSG' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~~~~~~~ include/linux/minmax.h:65:25: note: in expansion of macro 'statically_true' 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~~~~~~~~~~~~~~ include/linux/minmax.h:50:14: note: in expansion of macro '__is_nonneg' 50 | (2 + __is_nonneg(ux)) : (1 + 2 * (sizeof(ux) < 4))) | ^~~~~~~~~~~ include/linux/minmax.h:72:10: note: in expansion of macro '__sign_use' 72 | (__sign_use(ux) & __sign_use(uy)) | ^~~~~~~~~~ include/linux/minmax.h:90:27: note: in expansion of macro '__types_ok' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~ include/linux/minmax.h:95:9: note: in expansion of macro '__careful_cmp_once' 95 | __careful_cmp_once(op, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:102:25: note: in expansion of macro '__careful_cmp' 102 | #define min(x, y) __careful_cmp(min, x, y) | ^~~~~~~~~~~~~ lib/lzo/lzo1x_compress.c:65:54: note: in expansion of macro 'min' 65 | const unsigned char *limit = min(ip_end, ip + MAX_ZERO_RUN_LENGTH + 1); | ^~~ >> include/linux/minmax.h:65:46: warning: ordered comparison of pointer with integer zero [-Wextra] 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~ include/linux/compiler_types.h:610:23: note: in definition of macro '__compiletime_assert' 610 | if (!(condition)) \ | ^~~~~~~~~ include/linux/compiler_types.h:630:9: note: in expansion of macro '_compiletime_assert' 630 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:90:9: note: in expansion of macro 'BUILD_BUG_ON_MSG' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~~~~~~~ include/linux/minmax.h:65:25: note: in expansion of macro 'statically_true' 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~~~~~~~~~~~~~~ include/linux/minmax.h:50:14: note: in expansion of macro '__is_nonneg' 50 | (2 + __is_nonneg(ux)) : (1 + 2 * (sizeof(ux) < 4))) | ^~~~~~~~~~~ include/linux/minmax.h:72:27: note: in expansion of macro '__sign_use' 72 | (__sign_use(ux) & __sign_use(uy)) | ^~~~~~~~~~ include/linux/minmax.h:90:27: note: in expansion of macro '__types_ok' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~ include/linux/minmax.h:95:9: note: in expansion of macro '__careful_cmp_once' 95 | __careful_cmp_once(op, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:102:25: note: in expansion of macro '__careful_cmp' 102 | #define min(x, y) __careful_cmp(min, x, y) | ^~~~~~~~~~~~~ lib/lzo/lzo1x_compress.c:65:54: note: in expansion of macro 'min' 65 | const unsigned char *limit = min(ip_end, ip + MAX_ZERO_RUN_LENGTH + 1); | ^~~ >> include/linux/minmax.h:65:46: warning: ordered comparison of pointer with integer zero [-Wextra] 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~ include/linux/compiler_types.h:610:23: note: in definition of macro '__compiletime_assert' 610 | if (!(condition)) \ | ^~~~~~~~~ include/linux/compiler_types.h:630:9: note: in expansion of macro '_compiletime_assert' 630 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:90:9: note: in expansion of macro 'BUILD_BUG_ON_MSG' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~~~~~~~ include/linux/minmax.h:65:25: note: in expansion of macro 'statically_true' 65 | #define __is_nonneg(ux) statically_true((ux) >= 0) | ^~~~~~~~~~~~~~~ include/linux/minmax.h:50:14: note: in expansion of macro '__is_nonneg' 50 | (2 + __is_nonneg(ux)) : (1 + 2 * (sizeof(ux) < 4))) | ^~~~~~~~~~~ include/linux/minmax.h:72:27: note: in expansion of macro '__sign_use' 72 | (__sign_use(ux) & __sign_use(uy)) | ^~~~~~~~~~ include/linux/minmax.h:90:27: note: in expansion of macro '__types_ok' 90 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \ | ^~~~~~~~~~ include/linux/minmax.h:95:9: note: in expansion of macro '__careful_cmp_once' 95 | __careful_cmp_once(op, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) | ^~~~~~~~~~~~~~~~~~ include/linux/minmax.h:102:25: note: in expansion of macro '__careful_cmp' 102 | #define min(x, y) __careful_cmp(min, x, y) | ^~~~~~~~~~~~~ lib/lzo/lzo1x_compress.c:65:54: note: in expansion of macro 'min' 65 | const unsigned char *limit = min(ip_end, ip + MAX_ZERO_RUN_LENGTH + 1); | ^~~ vim +65 include/linux/minmax.h 9 10 /* 11 * min()/max()/clamp() macros must accomplish several things: 12 * 13 * - Avoid multiple evaluations of the arguments (so side-effects like 14 * "x++" happen only once) when non-constant. 15 * - Perform signed v unsigned type-checking (to generate compile 16 * errors instead of nasty runtime surprises). 17 * - Unsigned char/short are always promoted to signed int and can be 18 * compared against signed or unsigned arguments. 19 * - Unsigned arguments can be compared against non-negative signed constants. 20 * - Comparison of a signed argument against an unsigned constant fails 21 * even if the constant is below __INT_MAX__ and could be cast to int. 22 */ 23 #define __typecheck(x, y) \ 24 (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) 25 26 /* 27 * __sign_use for integer expressions: 28 * bit #0 set if ok for unsigned comparisons 29 * bit #1 set if ok for signed comparisons 30 * 31 * In particular, statically non-negative signed integer expressions 32 * are ok for both. 33 * 34 * NOTE! Unsigned types smaller than 'int' are implicitly converted to 'int' 35 * in expressions, and are accepted for signed conversions for now. 36 * This is debatable. 37 * 38 * Note that 'x' is the original expression, and 'ux' is the unique variable 39 * that contains the value. 40 * 41 * We use 'ux' for pure type checking, and 'x' for when we need to look at the 42 * value (but without evaluating it for side effects! 43 * Careful to only ever evaluate it with sizeof() or __builtin_constant_p() etc). 44 * 45 * Pointers end up being checked by the normal C type rules at the actual 46 * comparison, and these expressions only need to be careful to not cause 47 * warnings for pointer use. 48 */ 49 #define __sign_use(ux) (is_signed_type(typeof(ux)) ? \ 50 (2 + __is_nonneg(ux)) : (1 + 2 * (sizeof(ux) < 4))) 51 52 /* 53 * Check whether a signed value is always non-negative. 54 * 55 * On 64-bit any integer or pointer type can safely be cast to 'long long'. 56 * But on 32-bit we need to avoid warnings about casting pointers to integers 57 * of different sizes without truncating 64-bit values so 'long' or 'long long' 58 * must be used depending on the size of the value. 59 * 60 * This does not work for 128-bit signed integers since the cast would truncate 61 * them, but we do not use s128 types in the kernel (we do use 'u128', 62 * but they are handled by the !is_signed_type() case). 63 */ 64 #if __SIZEOF_POINTER__ == __SIZEOF_LONG_LONG__ > 65 #define __is_nonneg(ux) statically_true((ux) >= 0) 66 #else 67 #define __is_nonneg(ux) statically_true( \ 68 (typeof(__builtin_choose_expr(sizeof(ux) > 4, 1LL, 1L)))(ux) >= 0) 69 #endif 70 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-12-20 12:03 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-12-19 22:39 [PATCH v2 0/4] kbuild: remove gcc's -Wtype-limits Vincent Mailhol 2025-12-19 22:39 ` [PATCH v2 1/4] " Vincent Mailhol 2025-12-19 22:39 ` [PATCH v2 2/4] kbuild: cleanup local -Wno-type-limits exceptions Vincent Mailhol 2025-12-19 22:39 ` [PATCH v2 3/4] overflow: Remove is_non_negative() and is_negative() Vincent Mailhol 2025-12-19 22:39 ` [PATCH v2 4/4] minmax: remove useless cast in __is_nonneg() Vincent Mailhol 2025-12-20 10:02 ` David Laight 2025-12-20 10:53 ` Vincent Mailhol 2025-12-20 12:03 ` kernel test robot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox