Warnings should be emitted on successful compiles too.
BUG=3467229
Change-Id: I232605708b97dbe77ede1443bdb8af8f4af238b6
diff --git a/llvm-rs-cc.cpp b/llvm-rs-cc.cpp
index c4d9244..f0c24ca 100644
--- a/llvm-rs-cc.cpp
+++ b/llvm-rs-cc.cpp
@@ -404,21 +404,19 @@
}
// Let's rock!
- if (!Compiler->compile(IOFiles,
- DepFiles,
- Opts.mIncludePaths,
- Opts.mAdditionalDepTargets,
- Opts.mOutputType,
- Opts.mBitcodeStorage,
- Opts.mAllowRSPrefix,
- Opts.mOutputDep,
- Opts.mJavaReflectionPathBase,
- Opts.mJavaReflectionPackageName)) {
- llvm::errs() << Compiler->getErrorMessage();
- return 1;
- }
+ int CompileFailed = !Compiler->compile(IOFiles,
+ DepFiles,
+ Opts.mIncludePaths,
+ Opts.mAdditionalDepTargets,
+ Opts.mOutputType,
+ Opts.mBitcodeStorage,
+ Opts.mAllowRSPrefix,
+ Opts.mOutputDep,
+ Opts.mJavaReflectionPathBase,
+ Opts.mJavaReflectionPackageName);
+ llvm::errs() << Compiler->getErrorMessage();
- return 0;
+ return CompileFailed;
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/tests/P_alloc_in_struct/alloc_in_struct.rs b/tests/P_alloc_in_struct/alloc_in_struct.rs
index b35f350..eaefd87 100644
--- a/tests/P_alloc_in_struct/alloc_in_struct.rs
+++ b/tests/P_alloc_in_struct/alloc_in_struct.rs
@@ -1,13 +1,7 @@
#pragma version(1)
#pragma rs java_package_name(foo)
-typedef struct s {
+struct s {
rs_allocation a;
-};
-
-struct s myStruct;
-
-int root(int num) {
- return 10;
-}
+} myStruct;
diff --git a/tests/P_warnings/stderr.txt.expect b/tests/P_warnings/stderr.txt.expect
new file mode 100644
index 0000000..7e049dc
--- /dev/null
+++ b/tests/P_warnings/stderr.txt.expect
@@ -0,0 +1 @@
+warnings.rs:5:1: warning: control reaches end of non-void function
diff --git a/tests/P_warnings/stdout.txt.expect b/tests/P_warnings/stdout.txt.expect
new file mode 100644
index 0000000..6c45182
--- /dev/null
+++ b/tests/P_warnings/stdout.txt.expect
@@ -0,0 +1 @@
+Generating ScriptC_warnings.java ...
diff --git a/tests/P_warnings/warnings.rs b/tests/P_warnings/warnings.rs
new file mode 100644
index 0000000..28bf97e
--- /dev/null
+++ b/tests/P_warnings/warnings.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(foo)
+
+int foo() {
+}
+