[PATCH] D78641: [builtins] Add void prototype to unprototyped functions

Ayke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 08:06:20 PDT 2020


aykevl created this revision.
aykevl added reviewers: scanon, ab, MaskRay.
Herald added subscribers: Sanitizers, dylanmckay.
Herald added a project: Sanitizers.
aykevl edited the summary of this revision.

This patch replaces `()` prototypes with `(void)` prototypes, to avoid declaring these functions as variadic functions.

---

Found while porting compiler-rt to the AVR platform. There are still some Clang bugs where it uses the wrong address space for variadic functions, and this patch works around that. Of course this should also be fixed in Clang, but I think the effort started in D78491 <https://reviews.llvm.org/D78491> is a much more systematic approach (and will probably take a while until it is finished). Until then, this patch avoids some accidental variadic functions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78641

Files:
  compiler-rt/test/builtins/Unit/fp_test.h


Index: compiler-rt/test/builtins/Unit/fp_test.h
===================================================================
--- compiler-rt/test/builtins/Unit/fp_test.h
+++ compiler-rt/test/builtins/Unit/fp_test.h
@@ -211,23 +211,23 @@
     return "";
 }
 
-static inline uint16_t makeQNaN16()
+static inline uint16_t makeQNaN16(void)
 {
     return fromRep16(0x7e00U);
 }
 
-static inline float makeQNaN32()
+static inline float makeQNaN32(void)
 {
     return fromRep32(0x7fc00000U);
 }
 
-static inline double makeQNaN64()
+static inline double makeQNaN64(void)
 {
     return fromRep64(0x7ff8000000000000UL);
 }
 
 #if __LDBL_MANT_DIG__ == 113
-static inline long double makeQNaN128()
+static inline long double makeQNaN128(void)
 {
     return fromRep128(0x7fff800000000000UL, 0x0UL);
 }
@@ -255,23 +255,23 @@
 }
 #endif
 
-static inline uint16_t makeInf16()
+static inline uint16_t makeInf16(void)
 {
     return fromRep16(0x7c00U);
 }
 
-static inline float makeInf32()
+static inline float makeInf32(void)
 {
     return fromRep32(0x7f800000U);
 }
 
-static inline double makeInf64()
+static inline double makeInf64(void)
 {
     return fromRep64(0x7ff0000000000000UL);
 }
 
 #if __LDBL_MANT_DIG__ == 113
-static inline long double makeInf128()
+static inline long double makeInf128(void)
 {
     return fromRep128(0x7fff000000000000UL, 0x0UL);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78641.259286.patch
Type: text/x-patch
Size: 1348 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200422/70e903dd/attachment.bin>


More information about the llvm-commits mailing list