Skip to content

Commit 35bc8ff

Browse files
author
Robert Zakrzewski
committed
Limit new Floatxx types to master branch only
1 parent 55e9217 commit 35bc8ff

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/context.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,13 @@ pub struct CodegenCx<'gcc, 'tcx> {
7171

7272
pub float_type: Type<'gcc>,
7373
pub double_type: Type<'gcc>,
74+
#[cfg(feature="master")]
7475
pub float16_type: Type<'gcc>,
76+
#[cfg(feature="master")]
7577
pub float32_type: Type<'gcc>,
78+
#[cfg(feature="master")]
7679
pub float64_type: Type<'gcc>,
80+
#[cfg(feature="master")]
7781
pub float128_type: Type<'gcc>,
7882

7983
pub linkage: Cell<FunctionType>,
@@ -187,9 +191,13 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
187191
// TODO(antoyo): set alignment on those types as well.
188192
let float_type = context.new_type::<f32>();
189193
let double_type = context.new_type::<f64>();
194+
#[cfg(feature="master")]
190195
let float16_type = context.new_c_type(CType::Float16);
196+
#[cfg(feature="master")]
191197
let float32_type = context.new_c_type(CType::Float32);
198+
#[cfg(feature="master")]
192199
let float64_type = context.new_c_type(CType::Float64);
200+
#[cfg(feature="master")]
193201
let float128_type = context.new_c_type(CType::Float128);
194202

195203
let char_type = context.new_c_type(CType::Char);
@@ -316,9 +324,13 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
316324

317325
float_type,
318326
double_type,
327+
#[cfg(feature="master")]
319328
float16_type,
329+
#[cfg(feature="master")]
320330
float32_type,
331+
#[cfg(feature="master")]
321332
float64_type,
333+
#[cfg(feature="master")]
322334
float128_type,
323335

324336
linkage: Cell::new(FunctionType::Internal),

src/type_.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,15 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
120120
self.isize_type
121121
}
122122

123+
#[cfg(feature="master")]
123124
fn type_f16(&self) -> Type<'gcc> {
124125
self.float16_type
125126
}
127+
#[cfg(not(feature="master"))]
128+
fn type_f16(&self) -> Type<'gcc> {
129+
unimplemented!("f16")
130+
}
131+
126132

127133
fn type_f32(&self) -> Type<'gcc> {
128134
self.float_type
@@ -132,9 +138,14 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
132138
self.double_type
133139
}
134140

141+
#[cfg(feature="master")]
135142
fn type_f128(&self) -> Type<'gcc> {
136143
self.float128_type
137144
}
145+
#[cfg(not(feature="master"))]
146+
fn type_f128(&self) -> Type<'gcc> {
147+
unimplemented!("f128")
148+
}
138149

139150
fn type_func(&self, params: &[Type<'gcc>], return_type: Type<'gcc>) -> Type<'gcc> {
140151
self.context.new_function_pointer_type(None, return_type, params, false)

0 commit comments

Comments
 (0)