aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2021-06-17 19:05:35 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2021-06-17 19:05:35 +0000
commitf40564f85ec3e549f13dd83f0a4ce6bd40453d3c (patch)
treeb77bdf0926442a5b1c72f42c10ae68f67f57afa8
parent337522d4ddbbbed0d7751eb18698c853d719b4dd (diff)
parent2e01f57fe25142a13c23a8e0009927b601063546 (diff)
downloadslang-f40564f85ec3e549f13dd83f0a4ce6bd40453d3c.tar.gz
Change-Id: I169033188f8d916747964e9bf2bebc3fe840a886
-rw-r--r--Android.bp45
-rw-r--r--BitWriter_2_9/Android.bp9
-rw-r--r--BitWriter_2_9/BitcodeWriter.cpp2
-rw-r--r--BitWriter_2_9/ValueEnumerator.cpp4
-rw-r--r--BitWriter_2_9_func/Android.bp9
-rw-r--r--BitWriter_2_9_func/BitcodeWriter.cpp2
-rw-r--r--BitWriter_2_9_func/ValueEnumerator.cpp4
-rw-r--r--BitWriter_3_2/Android.bp9
-rw-r--r--BitWriter_3_2/BitcodeWriter.cpp2
-rw-r--r--BitWriter_3_2/ValueEnumerator.cpp4
-rw-r--r--METADATA3
-rw-r--r--StripUnkAttr/Android.bp9
-rw-r--r--llvm-rs-cc.cpp10
-rw-r--r--rs_cc_options.cpp15
-rw-r--r--slang_rs_context.cpp6
-rw-r--r--slang_rs_export_foreach.h2
-rw-r--r--slang_rs_reflection.cpp4
-rw-r--r--slang_version.h5
-rw-r--r--tests/P_warnings_deprecated/deprecated.rscript2
-rw-r--r--tests/P_warnings_deprecated/stderr.txt.expect1
-rwxr-xr-xtests/slang_test.py2
21 files changed, 114 insertions, 35 deletions
diff --git a/Android.bp b/Android.bp
index ce00396..8e7b887 100644
--- a/Android.bp
+++ b/Android.bp
@@ -14,6 +14,39 @@
// limitations under the License.
//
+package {
+ default_applicable_licenses: ["frameworks_compile_slang_license"],
+}
+
+// Added automatically by a large-scale-change that took the approach of
+// 'apply every license found to every target'. While this makes sure we respect
+// every license restriction, it may not be entirely correct.
+//
+// e.g. GPL in an MIT project might only apply to the contrib/ directory.
+//
+// Please consider splitting the single license below into multiple licenses,
+// taking care not to lose any license_kind information, and overriding the
+// default license using the 'licenses: [...]' property on targets as needed.
+//
+// For unused files, consider creating a 'fileGroup' with "//visibility:private"
+// to attach the license to, and including a comment whether the files may be
+// used in the current project.
+// See: http://go/android-license-faq
+license {
+ name: "frameworks_compile_slang_license",
+ visibility: [":__subpackages__"],
+ license_kinds: [
+ "SPDX-license-identifier-Apache-2.0",
+ "SPDX-license-identifier-BSD",
+ "SPDX-license-identifier-MIT",
+ "SPDX-license-identifier-NCSA",
+ "legacy_unencumbered",
+ ],
+ license_text: [
+ "NOTICE",
+ ],
+}
+
cc_defaults {
name: "rs-version",
cflags: [
@@ -103,12 +136,6 @@ cc_library_host_static {
],
shared_libs: ["libbcinfo"],
-
- product_variables: {
- unbundled_build: {
- enabled: false,
- },
- },
}
// ========================================================
@@ -188,12 +215,6 @@ cc_binary_host {
],
},
},
-
- product_variables: {
- unbundled_build: {
- enabled: false,
- },
- },
}
cc_binary_host {
diff --git a/BitWriter_2_9/Android.bp b/BitWriter_2_9/Android.bp
index 4a6bd28..e47a0d6 100644
--- a/BitWriter_2_9/Android.bp
+++ b/BitWriter_2_9/Android.bp
@@ -1,5 +1,14 @@
// For the host
// =====================================================
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "frameworks_compile_slang_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-NCSA
+ default_applicable_licenses: ["frameworks_compile_slang_license"],
+}
+
cc_library_host_static {
name: "libLLVMBitWriter_2_9",
defaults: ["slang-defaults"],
diff --git a/BitWriter_2_9/BitcodeWriter.cpp b/BitWriter_2_9/BitcodeWriter.cpp
index caee7de..8942e47 100644
--- a/BitWriter_2_9/BitcodeWriter.cpp
+++ b/BitWriter_2_9/BitcodeWriter.cpp
@@ -1698,7 +1698,7 @@ static void EmitDarwinBCHeaderAndTrailer(SmallVectorImpl<char> &Buffer,
WriteInt32ToBuffer(BCSize , Buffer, Position);
WriteInt32ToBuffer(CPUType , Buffer, Position);
- // If the file is not a multiple of 16 bytes, insert dummy padding.
+ // If the file is not a multiple of 16 bytes, insert placeholder padding.
while (Buffer.size() & 15)
Buffer.push_back(0);
}
diff --git a/BitWriter_2_9/ValueEnumerator.cpp b/BitWriter_2_9/ValueEnumerator.cpp
index dedbedd..8d6475c 100644
--- a/BitWriter_2_9/ValueEnumerator.cpp
+++ b/BitWriter_2_9/ValueEnumerator.cpp
@@ -263,7 +263,7 @@ void ValueEnumerator::EnumerateMetadata(const llvm::Metadata *MD) {
(isa<MDNode>(MD) || isa<MDString>(MD) || isa<ConstantAsMetadata>(MD)) &&
"Invalid metadata kind");
- // Insert a dummy ID to block the co-recursive call to
+ // Insert a placeholder ID to block the co-recursive call to
// EnumerateMDNodeOperands() from re-visiting MD in a cyclic graph.
//
// Return early if there's already an ID.
@@ -279,7 +279,7 @@ void ValueEnumerator::EnumerateMetadata(const llvm::Metadata *MD) {
HasMDString |= isa<MDString>(MD);
HasDILocation |= isa<DILocation>(MD);
- // Replace the dummy ID inserted above with the correct one. MDValueMap may
+ // Replace the placeholder ID inserted above with the correct one. MDValueMap may
// have changed by inserting operands, so we need a fresh lookup here.
MDs.push_back(MD);
MDValueMap[MD] = MDs.size();
diff --git a/BitWriter_2_9_func/Android.bp b/BitWriter_2_9_func/Android.bp
index b14d3e6..b4b7c47 100644
--- a/BitWriter_2_9_func/Android.bp
+++ b/BitWriter_2_9_func/Android.bp
@@ -1,5 +1,14 @@
// For the host
// =====================================================
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "frameworks_compile_slang_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-NCSA
+ default_applicable_licenses: ["frameworks_compile_slang_license"],
+}
+
cc_library_host_static {
name: "libLLVMBitWriter_2_9_func",
defaults: ["slang-defaults"],
diff --git a/BitWriter_2_9_func/BitcodeWriter.cpp b/BitWriter_2_9_func/BitcodeWriter.cpp
index 3ed3380..30b8e7d 100644
--- a/BitWriter_2_9_func/BitcodeWriter.cpp
+++ b/BitWriter_2_9_func/BitcodeWriter.cpp
@@ -1762,7 +1762,7 @@ static void EmitDarwinBCHeaderAndTrailer(SmallVectorImpl<char> &Buffer,
WriteInt32ToBuffer(BCSize , Buffer, Position);
WriteInt32ToBuffer(CPUType , Buffer, Position);
- // If the file is not a multiple of 16 bytes, insert dummy padding.
+ // If the file is not a multiple of 16 bytes, insert placeholder padding.
while (Buffer.size() & 15)
Buffer.push_back(0);
}
diff --git a/BitWriter_2_9_func/ValueEnumerator.cpp b/BitWriter_2_9_func/ValueEnumerator.cpp
index ce785da..0690af7 100644
--- a/BitWriter_2_9_func/ValueEnumerator.cpp
+++ b/BitWriter_2_9_func/ValueEnumerator.cpp
@@ -263,7 +263,7 @@ void ValueEnumerator::EnumerateMetadata(const llvm::Metadata *MD) {
(isa<MDNode>(MD) || isa<MDString>(MD) || isa<ConstantAsMetadata>(MD)) &&
"Invalid metadata kind");
- // Insert a dummy ID to block the co-recursive call to
+ // Insert a placeholder ID to block the co-recursive call to
// EnumerateMDNodeOperands() from re-visiting MD in a cyclic graph.
//
// Return early if there's already an ID.
@@ -279,7 +279,7 @@ void ValueEnumerator::EnumerateMetadata(const llvm::Metadata *MD) {
HasMDString |= isa<MDString>(MD);
HasDILocation |= isa<DILocation>(MD);
- // Replace the dummy ID inserted above with the correct one. MDValueMap may
+ // Replace the placeholder ID inserted above with the correct one. MDValueMap may
// have changed by inserting operands, so we need a fresh lookup here.
MDs.push_back(MD);
MDValueMap[MD] = MDs.size();
diff --git a/BitWriter_3_2/Android.bp b/BitWriter_3_2/Android.bp
index 89282cc..f87a2fa 100644
--- a/BitWriter_3_2/Android.bp
+++ b/BitWriter_3_2/Android.bp
@@ -1,5 +1,14 @@
// For the host and device
// =====================================================
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "frameworks_compile_slang_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-NCSA
+ default_applicable_licenses: ["frameworks_compile_slang_license"],
+}
+
cc_library_static {
name: "libLLVMBitWriter_3_2",
vendor_available: true,
diff --git a/BitWriter_3_2/BitcodeWriter.cpp b/BitWriter_3_2/BitcodeWriter.cpp
index c57dd45..2099ac0 100644
--- a/BitWriter_3_2/BitcodeWriter.cpp
+++ b/BitWriter_3_2/BitcodeWriter.cpp
@@ -1836,7 +1836,7 @@ static void EmitDarwinBCHeaderAndTrailer(SmallVectorImpl<char> &Buffer,
WriteInt32ToBuffer(BCSize , Buffer, Position);
WriteInt32ToBuffer(CPUType , Buffer, Position);
- // If the file is not a multiple of 16 bytes, insert dummy padding.
+ // If the file is not a multiple of 16 bytes, insert placeholder padding.
while (Buffer.size() & 15)
Buffer.push_back(0);
}
diff --git a/BitWriter_3_2/ValueEnumerator.cpp b/BitWriter_3_2/ValueEnumerator.cpp
index 4ce2ec6..9d74d75 100644
--- a/BitWriter_3_2/ValueEnumerator.cpp
+++ b/BitWriter_3_2/ValueEnumerator.cpp
@@ -263,7 +263,7 @@ void ValueEnumerator::EnumerateMetadata(const llvm::Metadata *MD) {
(isa<MDNode>(MD) || isa<MDString>(MD) || isa<ConstantAsMetadata>(MD)) &&
"Invalid metadata kind");
- // Insert a dummy ID to block the co-recursive call to
+ // Insert a placeholder ID to block the co-recursive call to
// EnumerateMDNodeOperands() from re-visiting MD in a cyclic graph.
//
// Return early if there's already an ID.
@@ -279,7 +279,7 @@ void ValueEnumerator::EnumerateMetadata(const llvm::Metadata *MD) {
HasMDString |= isa<MDString>(MD);
HasDILocation |= isa<DILocation>(MD);
- // Replace the dummy ID inserted above with the correct one. MDValueMap may
+ // Replace the placeholder ID inserted above with the correct one. MDValueMap may
// have changed by inserting operands, so we need a fresh lookup here.
MDs.push_back(MD);
MDValueMap[MD] = MDs.size();
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..d97975c
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,3 @@
+third_party {
+ license_type: NOTICE
+}
diff --git a/StripUnkAttr/Android.bp b/StripUnkAttr/Android.bp
index d7082a7..6dcdbcc 100644
--- a/StripUnkAttr/Android.bp
+++ b/StripUnkAttr/Android.bp
@@ -1,5 +1,14 @@
// For the host and device
// =====================================================
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "frameworks_compile_slang_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["frameworks_compile_slang_license"],
+}
+
cc_library_static {
name: "libStripUnkAttr",
vendor_available: true,
diff --git a/llvm-rs-cc.cpp b/llvm-rs-cc.cpp
index a51e672..0c1143d 100644
--- a/llvm-rs-cc.cpp
+++ b/llvm-rs-cc.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include "clang/Basic/AllDiagnostics.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Driver/Options.h"
@@ -223,6 +224,14 @@ extern "C" const char *__asan_default_options() {
return "detect_leaks=0";
}
+static void emitDeprecationWarning(clang::DiagnosticsEngine *DiagEngine) {
+ DiagEngine->Report(clang::diag::warn_deprecated_message)
+ << "Renderscript"
+ << "Please refer to the migration guide "
+ "(https://developer.android.com/guide/topics/renderscript/migration-guide) "
+ "for the proposed alternatives.";
+}
+
int main(int argc, const char **argv) {
llvm::llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
LLVMInitializeARMTargetInfo();
@@ -263,6 +272,7 @@ int main(int argc, const char **argv) {
(void)DiagEngine.setSeverityForGroup(clang::diag::Flavor::WarningOrError,
"implicit-function-declaration",
clang::diag::Severity::Error);
+ emitDeprecationWarning(&DiagEngine);
// Report error if no input file
if (Inputs.empty()) {
diff --git a/rs_cc_options.cpp b/rs_cc_options.cpp
index f84294b..89720a3 100644
--- a/rs_cc_options.cpp
+++ b/rs_cc_options.cpp
@@ -133,6 +133,11 @@ bool ParseArguments(const llvm::ArrayRef<const char *> &ArgsIn,
// employ/encourage this extension for zero-initialization of structures.
DiagOpts.Warnings.push_back("no-gnu-empty-initializer");
+ // Always turn deprecation warning into a warning even if -Werror is specified.
+ // This is because we will always emit RenderScript deprecation warning, and turning
+ // it into an error will make the compilation always fail.
+ DiagOpts.Warnings.push_back("no-error=deprecated-declarations");
+
for (llvm::opt::ArgList::const_iterator it = Args.begin(), ie = Args.end();
it != ie; ++it) {
const llvm::opt::Arg *A = *it;
@@ -290,13 +295,11 @@ bool ParseArguments(const llvm::ArrayRef<const char *> &ArgsIn,
if (Opts.mTargetAPI == 0) {
Opts.mTargetAPI = UINT_MAX;
- } else if (Opts.mTargetAPI == SLANG_N_MR1_TARGET_API ||
- Opts.mTargetAPI == SLANG_O_TARGET_API ||
- Opts.mTargetAPI == SLANG_O_MR1_TARGET_API ||
- Opts.mTargetAPI == SLANG_P_TARGET_API) {
+ } else if (Opts.mTargetAPI > SLANG_MAXIMUM_TARGET_API &&
+ Opts.mTargetAPI <= SLANG_MAXIMUM_CMDLINE_TARGET_API) {
// Bug: http://b/35767071
- // No new APIs for N_MR1, O, O_MR1 and P, convert to N.
- Opts.mTargetAPI = SLANG_N_TARGET_API;
+ // No new APIs after N, convert to N.
+ Opts.mTargetAPI = SLANG_MAXIMUM_TARGET_API;
}
if ((Opts.mTargetAPI < 21) || (Opts.mBitcodeStorage == BCST_CPP_CODE))
diff --git a/slang_rs_context.cpp b/slang_rs_context.cpp
index b2c3179..ed2c47e 100644
--- a/slang_rs_context.cpp
+++ b/slang_rs_context.cpp
@@ -276,7 +276,7 @@ bool RSContext::processExports() {
}
}
- // Create a dummy root in slot 0 if a root kernel is not seen
+ // Create a placeholder root in slot 0 if a root kernel is not seen
// and there exists a non-root kernel.
if (valid && mExportForEach[0] == nullptr) {
const size_t numExportedForEach = mExportForEach.size();
@@ -302,7 +302,7 @@ bool RSContext::processExports() {
}
bool RSContext::processReducePragmas(Backend *BE) {
- // This is needed to ensure that the dummy variable is emitted into
+ // This is needed to ensure that the placeholder variable is emitted into
// the bitcode -- which in turn forces the function to be emitted
// into the bitcode. We couldn't do this at
// markUsedByReducePragma() time because we had to wait until the
@@ -346,7 +346,7 @@ void RSContext::markUsedByReducePragma(clang::FunctionDecl *FD, CheckName Check)
// reduce).
FD->setIsUsed();
- // Each constituent function "f" of a reduction kernel gets a dummy variable generated for it:
+ // Each constituent function "f" of a reduction kernel gets a placeholder variable generated for it:
// void *.rs.reduce_fn.f = (void*)&f;
// This is a trick to ensure that clang will not delete "f" as unused.
diff --git a/slang_rs_export_foreach.h b/slang_rs_export_foreach.h
index 4622e24..d5928f5 100644
--- a/slang_rs_export_foreach.h
+++ b/slang_rs_export_foreach.h
@@ -48,7 +48,7 @@ class RSExportForEach : public RSExportable {
std::string mName;
// For diagnostic purposes, we record the order in which we parse
- // foreach kernels. Does not apply to a dummy root.
+ // foreach kernels. Does not apply to a placeholder root.
unsigned mOrdinal;
RSExportRecordType *mParamPacketType;
diff --git a/slang_rs_reflection.cpp b/slang_rs_reflection.cpp
index 2c30e4f..875d84b 100644
--- a/slang_rs_reflection.cpp
+++ b/slang_rs_reflection.cpp
@@ -1005,7 +1005,7 @@ void RSReflectionJava::genExportForEach(const RSExportForEach *EF) {
mState->declareForEachDummyRoot(EF);
if (!mCollecting) {
- // Skip reflection for dummy root() kernels. Note that we have to
+ // Skip reflection for placeholder root() kernels. Note that we have to
// advance the next slot number for ForEach, however.
mOut.indent() << "//private final static int "
<< RS_EXPORT_FOREACH_INDEX_PREFIX << EF->getName() << " = "
@@ -1498,7 +1498,7 @@ void RSReflectionJava::genExportReduceAllocationVariant(const RSExportReduce *ER
mOut.indent() << "// " << InComment << "\n";
startFunction(AM_Public, false, ResultTypeName.c_str(), MethodName, Args);
const std::string &In0Name = Args[0].second;
- // Sanity-check inputs
+ // Validity-check inputs
if (Ins.size() > 1)
mOut.indent() << "Type t0, t1;\n";
for (size_t InIdx = 0, InEnd = Ins.size(); InIdx < InEnd; ++InIdx) {
diff --git a/slang_version.h b/slang_version.h
index 7ca6230..e6e47a3 100644
--- a/slang_version.h
+++ b/slang_version.h
@@ -46,7 +46,12 @@ enum SlangTargetAPI {
SLANG_O_TARGET_API = 26,
SLANG_O_MR1_TARGET_API = 27,
SLANG_P_TARGET_API = 28,
+ SLANG_Q_TARGET_API = 29,
+ SLANG_R_TARGET_API = 30,
+ SLANG_S_TARGET_API = 31,
SLANG_MAXIMUM_TARGET_API = RS_VERSION,
+ // The maximum API level that is acceptable for the "-target-api" commandline option.
+ SLANG_MAXIMUM_CMDLINE_TARGET_API = SLANG_S_TARGET_API,
SLANG_DEVELOPMENT_TARGET_API = RS_DEVELOPMENT_API
};
// Note that RS_VERSION is defined at build time (see Android.mk for details).
diff --git a/tests/P_warnings_deprecated/deprecated.rscript b/tests/P_warnings_deprecated/deprecated.rscript
index 4e5f5af..03f0185 100644
--- a/tests/P_warnings_deprecated/deprecated.rscript
+++ b/tests/P_warnings_deprecated/deprecated.rscript
@@ -1,4 +1,4 @@
-// -target-api 22
+// -target-api 22 -Wdeprecated-declarations
#pragma version(1)
#pragma rs java_package_name(foo)
diff --git a/tests/P_warnings_deprecated/stderr.txt.expect b/tests/P_warnings_deprecated/stderr.txt.expect
index ca4afee..4241202 100644
--- a/tests/P_warnings_deprecated/stderr.txt.expect
+++ b/tests/P_warnings_deprecated/stderr.txt.expect
@@ -1,3 +1,4 @@
+warning: Renderscript is deprecated: Please refer to the migration guide (https://developer.android.com/guide/topics/renderscript/migration-guide) for the proposed alternatives.
deprecated.rscript:9:9: warning: 'rsClamp' is deprecated: Use clamp() instead.
../../../../../frameworks/rs/script_api/include/rs_math.rsh:6482:5: note: 'rsClamp' has been explicitly marked deprecated here
deprecated.rscript:10:8: warning: 'rsGetAllocation' is deprecated: This function is deprecated and will be removed from the SDK in a future release.
diff --git a/tests/slang_test.py b/tests/slang_test.py
index 82593cc..628ec7f 100755
--- a/tests/slang_test.py
+++ b/tests/slang_test.py
@@ -163,7 +163,7 @@ GetOutDir.cache = None
def CreateCmd():
"""Creates the test command to run for the current test."""
- cmd_string = ('%s/bin/llvm-rs-cc -o tmp/ -p tmp/ -MD '
+ cmd_string = ('%s/bin/llvm-rs-cc -o tmp/ -p tmp/ -MD -Wno-deprecated-declarations '
'-I ../../../../../frameworks/rs/script_api/include/ '
'-I ../../../../../external/clang/lib/Headers/') % GetOutDir()
base_args = cmd_string.split()