[pkg-d-commits] [ldc] 35/211: Fix and try to make @weak test clearer
Matthias Klumpp
mak at moszumanska.debian.org
Sun Apr 23 22:36:07 UTC 2017
This is an automated email from the git hooks/post-receive script.
mak pushed a commit to annotated tag v1.1.0
in repository ldc.
commit 3893840f734c02ac4b747bb7911a29a9a0d97061
Author: Martin <noone at nowhere.com>
Date: Thu Sep 22 01:03:07 2016 +0200
Fix and try to make @weak test clearer
---
tests/codegen/attr_weak.d | 17 ++++++++---------
tests/codegen/inputs/attr_weak_input.d | 6 ------
2 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/tests/codegen/attr_weak.d b/tests/codegen/attr_weak.d
index 0a17b6a..8d043ea 100644
--- a/tests/codegen/attr_weak.d
+++ b/tests/codegen/attr_weak.d
@@ -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 );
}
diff --git a/tests/codegen/inputs/attr_weak_input.d b/tests/codegen/inputs/attr_weak_input.d
index 5ce18b0..5509aec 100644
--- a/tests/codegen/inputs/attr_weak_input.d
+++ b/tests/codegen/inputs/attr_weak_input.d
@@ -1,9 +1,3 @@
-import ldc.attributes;
-
-extern(C) @weak int return_two() {
- return 1;
-}
-
extern(C) int return_seven() {
return 7;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git
More information about the pkg-d-commits
mailing list