mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-29 06:30:39 +03:00
Fix and try to make @weak test clearer
This commit is contained in:
parent
b1a6315ee4
commit
3893840f73
2 changed files with 8 additions and 15 deletions
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
import ldc.attributes;
|
||||
|
||||
extern(C) @weak int return_two() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern(C) int return_seven() {
|
||||
return 7;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue