Fix and try to make @weak test clearer

This commit is contained in:
Martin 2016-09-22 01:03:07 +02:00
parent b1a6315ee4
commit 3893840f73
2 changed files with 8 additions and 15 deletions

View file

@ -1,21 +1,20 @@
// Test linking+running a program with @weak functions
// Test linking+running a program with @weak function
// RUN: %ldc -O3 %S/inputs/attr_weak_input.d -c -of=%t%obj
// RUN: %ldc -O3 %t%obj -run %s
// RUN: %ldc -O3 %S/inputs/attr_weak_input.d -c -of=%T/attr_weak_input%obj
// RUN: %ldc -O3 %T/attr_weak_input%obj %s -of=%t%exe
// RUN: %t%exe
import ldc.attributes;
extern(C) int return_two() {
return 2;
}
// Should be overridden by attr_weak_input.d
// Should be overridden by attr_weak_input.d (but only because its object
// file is specified before this one for the linker).
// The @weak attribute prevents the optimizer from making any assumptions
// though, so the call below is not inlined.
extern(C) @weak int return_seven() {
return 1;
}
void main() {
assert( return_two() == 2 );
assert( return_seven() == 7 );
}

View file

@ -1,9 +1,3 @@
import ldc.attributes;
extern(C) @weak int return_two() {
return 1;
}
extern(C) int return_seven() {
return 7;
}