[PATCH] D85731: [builtins] Make softfloat-related errors less noisy
Anatoly Trosinenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 11 07:07:02 PDT 2020
atrosinenko created this revision.
atrosinenko added reviewers: asl, scanon, howard.hinnant.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
atrosinenko requested review of this revision.
Choose SINGLE_PRECISION by default in fp_lib.h after `#error`ing when
incorrectly configured. This eliminates cluttering log with lots of
"unknown type name 'fp_t'" and so on after the descriptive error was
manually generated.
This makes clang-tidy output more relevant for `fp_*_impl.inc` while
checking macroses even stricter (checking that *exactly* one is
defined instead of *at least* one).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D85731
Files:
compiler-rt/lib/builtins/fp_lib.h
Index: compiler-rt/lib/builtins/fp_lib.h
===================================================================
--- compiler-rt/lib/builtins/fp_lib.h
+++ compiler-rt/lib/builtins/fp_lib.h
@@ -26,6 +26,15 @@
#include <stdbool.h>
#include <stdint.h>
+#if (defined(SINGLE_PRECISION) + defined(DOUBLE_PRECISION) + \
+ defined(QUAD_PRECISION)) != 1
+#error Exactly one of SINGLE_PRECISION, DOUBLE_PRECISION or QUAD_PRECISION must be defined.
+// Now, turn on some arbitrary one of the three precision settings (except for
+// QUAD_PRECISION that has some specific requirements), so fp_*_impl.inc files
+// could be validated by clang-tidy in a more meaningful way.
+#define SINGLE_PRECISION
+#endif
+
// x86_64 FreeBSD prior v9.3 define fixed-width types incorrectly in
// 32-bit mode.
#if defined(__FreeBSD__) && defined(__i386__)
@@ -195,6 +204,8 @@
#undef Word_FullMask
#endif // __LDBL_MANT_DIG__ == 113 && __SIZEOF_INT128__
#else
+// Should never be reached due to the check for precison-related macro
+// at the top of this file. Recheck it here just in case...
#error SINGLE_PRECISION, DOUBLE_PRECISION or QUAD_PRECISION must be defined.
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85731.284703.patch
Type: text/x-patch
Size: 1180 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200811/9980b36b/attachment.bin>
More information about the cfe-commits
mailing list