Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit 92034f2

Browse files
committed
Compile fixes for GCC 6+
1 parent 68a51d8 commit 92034f2

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

src/codegen/codegen.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,23 @@ llvm::Value *CodeGen::Printf(const std::string &format,
155155
const std::vector<llvm::Value *> &args) {
156156
auto *printf_fn = LookupBuiltin("printf");
157157
if (printf_fn == nullptr) {
158+
#if GCC_AT_LEAST_6
159+
#pragma GCC diagnostic push
160+
#pragma GCC diagnostic ignored "-Wignored-attributes"
161+
#endif
158162
printf_fn = RegisterBuiltin(
159163
"printf", llvm::TypeBuilder<decltype(printf), false>::get(GetContext()),
160164
reinterpret_cast<void *>(printf));
165+
#if GCC_AT_LEAST_6
166+
#pragma GCC diagnostic pop
167+
#endif
161168
}
162169

163170
// Collect all the arguments into a vector
164171
std::vector<llvm::Value *> printf_args = {ConstString(format, "format")};
165172
printf_args.insert(printf_args.end(), args.begin(), args.end());
166173

167-
// Call the function
174+
// Call printf()
168175
return CallFunc(printf_fn, printf_args);
169176
}
170177

@@ -173,11 +180,20 @@ llvm::Value *CodeGen::Memcmp(llvm::Value *ptr1, llvm::Value *ptr2,
173180
static constexpr char kMemcmpFnName[] = "memcmp";
174181
auto *memcmp_fn = LookupBuiltin(kMemcmpFnName);
175182
if (memcmp_fn == nullptr) {
183+
#if GCC_AT_LEAST_6
184+
#pragma GCC diagnostic push
185+
#pragma GCC diagnostic ignored "-Wignored-attributes"
186+
#endif
176187
memcmp_fn = RegisterBuiltin(
177188
kMemcmpFnName,
178189
llvm::TypeBuilder<decltype(memcmp), false>::get(GetContext()),
179190
reinterpret_cast<void *>(printf));
191+
#if GCC_AT_LEAST_6
192+
#pragma GCC diagnostic pop
193+
#endif
180194
}
195+
196+
// Call memcmp()
181197
return CallFunc(memcmp_fn, {ptr1, ptr2, len});
182198
}
183199

src/function/date_functions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ int32_t DateFunctions::DateToJulian(int32_t year, int32_t month, int32_t day) {
8282
return julian;
8383
}
8484

85-
void DateFunctions::JulianToDate(int32_t julian_date, int32_t &year, int32_t &month,
86-
int32_t &day) {
85+
void DateFunctions::JulianToDate(int32_t julian_date, int32_t &year,
86+
int32_t &month, int32_t &day) {
8787
// From Postgres j2date()
8888

8989
uint32_t julian = static_cast<uint32_t>(julian_date);

src/include/common/macros.h

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,13 @@ namespace peloton {
9797
#endif /* CHECK_INVARIANTS */
9898

9999
//===--------------------------------------------------------------------===//
100-
// override
100+
// Compiler version checks
101101
//===--------------------------------------------------------------------===//
102102

103-
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
104-
#define GCC_AT_LEAST_47 1
103+
#if __GNUC__ > 6 || (__GNUC__ == 6 && __GNUC_MINOR__ >= 0)
104+
#define GCC_AT_LEAST_6 1
105105
#else
106-
#define GCC_AT_LEAST_47 0
107-
#endif
108-
109-
// g++-4.6 does not support override
110-
#if GCC_AT_LEAST_47
111-
#define OVERRIDE override
112-
#else
113-
#define OVERRIDE
106+
#define GCC_AT_LEAST_6 0
114107
#endif
115108

116109
//===--------------------------------------------------------------------===//

0 commit comments

Comments
 (0)