Skip to content

Commit 3de30f4

Browse files
committed
rt: Change alignof to rust_alignof. Remove -Wno-c++11-compat. Closes #1644
1 parent dd610a1 commit 3de30f4

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

mk/platform.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,7 @@ ifeq ($(CFG_C_COMPILER),clang)
210210
CC=clang
211211
CXX=clang++
212212
CPP=cpp
213-
# -Wno-c++11-compat allows us to use 'alignof' as an identifier in the runtime
214-
CFG_GCCISH_CFLAGS += -Wall -Werror -Wno-c++11-compat -fno-rtti -g
213+
CFG_GCCISH_CFLAGS += -Wall -Werror -fno-rtti -g
215214
CFG_GCCISH_LINK_FLAGS += -g
216215
CFG_DEPEND_C = $(CFG_GCCISH_CROSS)$(CXX) $(CFG_GCCISH_CFLAGS) -MT "$(1)" \
217216
-MM $(2)

src/rt/rust_shape.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ size_of::compute_tag_size(tag_info &tinfo) {
212212
tinfo.tag_sa.set(1, 1);
213213
} else {
214214
// Add in space for the tag.
215-
tinfo.tag_sa.add(sizeof(tag_variant_t), alignof<tag_align_t>());
215+
tinfo.tag_sa.add(sizeof(tag_variant_t), rust_alignof<tag_align_t>());
216216
}
217217
}
218218

@@ -277,7 +277,7 @@ class cmp : public data<cmp,ptr_pair> {
277277
}
278278

279279
inline void cmp_two_pointers() {
280-
ALIGN_TO(alignof<void *>());
280+
ALIGN_TO(rust_alignof<void *>());
281281
data_pair<uint8_t *> fst = bump_dp<uint8_t *>(dp);
282282
data_pair<uint8_t *> snd = bump_dp<uint8_t *>(dp);
283283
cmp_number(fst);
@@ -286,7 +286,7 @@ class cmp : public data<cmp,ptr_pair> {
286286
}
287287

288288
inline void cmp_pointer() {
289-
ALIGN_TO(alignof<void *>());
289+
ALIGN_TO(rust_alignof<void *>());
290290
cmp_number(bump_dp<uint8_t *>(dp));
291291
}
292292

src/rt/rust_shape.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class arena {
108108

109109
template<typename T>
110110
inline size_t
111-
alignof() {
111+
rust_alignof() {
112112
#ifdef _MSC_VER
113113
return __alignof(T);
114114
#else
@@ -118,7 +118,7 @@ alignof() {
118118

119119
template<>
120120
inline size_t
121-
alignof<double>() {
121+
rust_alignof<double>() {
122122
return 4;
123123
}
124124

@@ -649,7 +649,7 @@ class size_of : public ctxt<size_of> {
649649
}
650650

651651
template<typename T>
652-
void walk_number1() { sa.set(sizeof(T), alignof<T>()); }
652+
void walk_number1() { sa.set(sizeof(T), rust_alignof<T>()); }
653653

654654
void compute_tag_size(tag_info &tinfo);
655655

@@ -851,7 +851,7 @@ namespace shape {
851851
}
852852

853853
#define DATA_SIMPLE(ty, call) \
854-
ALIGN_TO(alignof<ty>()); \
854+
ALIGN_TO(rust_alignof<ty>()); \
855855
U end_dp = dp + sizeof(ty); \
856856
static_cast<T *>(this)->call; \
857857
dp = end_dp;
@@ -899,21 +899,21 @@ class data : public ctxt< data<T,U> > {
899899
void walk_uniq1() { DATA_SIMPLE(void *, walk_uniq2()); }
900900

901901
void walk_fn1(char code) {
902-
ALIGN_TO(alignof<void *>());
902+
ALIGN_TO(rust_alignof<void *>());
903903
U next_dp = dp + sizeof(void *) * 2;
904904
static_cast<T *>(this)->walk_fn2(code);
905905
dp = next_dp;
906906
}
907907

908908
void walk_iface1() {
909-
ALIGN_TO(alignof<void *>());
909+
ALIGN_TO(rust_alignof<void *>());
910910
U next_dp = dp + sizeof(void *);
911911
static_cast<T *>(this)->walk_iface2();
912912
dp = next_dp;
913913
}
914914

915915
void walk_tydesc1(char kind) {
916-
ALIGN_TO(alignof<void *>());
916+
ALIGN_TO(rust_alignof<void *>());
917917
U next_dp = dp + sizeof(void *);
918918
static_cast<T *>(this)->walk_tydesc2(kind);
919919
dp = next_dp;
@@ -938,7 +938,7 @@ class data : public ctxt< data<T,U> > {
938938
template<typename WN>
939939
void walk_number1() {
940940
//DATA_SIMPLE(W, walk_number2<W>());
941-
ALIGN_TO(alignof<WN>());
941+
ALIGN_TO(rust_alignof<WN>());
942942
U end_dp = dp + sizeof(WN);
943943
T* t = static_cast<T *>(this);
944944
t->template walk_number2<WN>();
@@ -1003,7 +1003,7 @@ data<T,U>::walk_tag1(tag_info &tinfo) {
10031003
size_of::compute_tag_size(*this, tinfo);
10041004

10051005
if (tinfo.variant_count > 1)
1006-
ALIGN_TO(alignof<tag_align_t>());
1006+
ALIGN_TO(rust_alignof<tag_align_t>());
10071007

10081008
U end_dp = dp + tinfo.tag_sa.size;
10091009

0 commit comments

Comments
 (0)