aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AST.cpp10
-rw-r--r--ConstantExpression.cpp3
-rw-r--r--Coordinator.cpp68
-rw-r--r--FmqType.cpp4
-rw-r--r--Interface.cpp29
-rw-r--r--Scope.cpp4
-rw-r--r--generateCpp.cpp4
7 files changed, 58 insertions, 64 deletions
diff --git a/AST.cpp b/AST.cpp
index d6abe30a..15cb0b3c 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -284,8 +284,6 @@ bool AST::addImport(const char *import) {
fqName.applyDefaults(mPackage.package(), mPackage.version());
- // LOG(INFO) << "importing " << fqName.string();
-
if (fqName.name().empty()) {
// import a package
std::vector<FQName> packageInterfaces;
@@ -575,14 +573,6 @@ Type *AST::lookupTypeFromImports(const FQName &fqName) {
}
if (resolvedType) {
-#if 0
- LOG(INFO) << "found '"
- << resolvedName.string()
- << "' after looking for '"
- << fqName.string()
- << "'.";
-#endif
-
returnedType = resolvedType;
// If the resolved type is not an interface, we need to determine
diff --git a/ConstantExpression.cpp b/ConstantExpression.cpp
index b6857a71..51865668 100644
--- a/ConstantExpression.cpp
+++ b/ConstantExpression.cpp
@@ -87,8 +87,7 @@ ScalarType::Kind usualArithmeticConversion(ScalarType::Kind lft,
// Although there is such rule to return "the unsigned counterpart of
// the signed operand", it should not reach here in our HIDL grammar.
- LOG(FATAL) << "Could not do usual arithmetic conversion for type "
- << lft << "and" << rgt;
+ CHECK(false) << "Could not do usual arithmetic conversion for type " << lft << "and" << rgt;
switch(signedRank) {
case SK(INT8): return SK(UINT8);
case SK(INT16): return SK(UINT16);
diff --git a/Coordinator.cpp b/Coordinator.cpp
index 337912b2..b14381d8 100644
--- a/Coordinator.cpp
+++ b/Coordinator.cpp
@@ -25,6 +25,7 @@
#include <android-base/logging.h>
#include <hidl-hash/Hash.h>
#include <hidl-util/StringHelper.h>
+#include <iostream>
#include "AST.h"
#include "Interface.h"
@@ -399,14 +400,10 @@ status_t Coordinator::appendPackageInterfacesToVector(
package.package() + package.atVersion() + "::" + fileName);
if (!subFQName.isValid()) {
- LOG(WARNING)
- << "Whole-package import encountered invalid filename '"
- << fileName
- << "' in package "
- << package.package()
- << package.atVersion();
+ std::cerr << "ERROR: Whole-package import encountered invalid filename '" << fileName
+ << "' in package " << package.package() << package.atVersion() << std::endl;
- continue;
+ return UNKNOWN_ERROR;
}
packageInterfaces->push_back(subFQName);
@@ -449,8 +446,8 @@ status_t Coordinator::enforceRestrictionsOnPackage(const FQName& fqName,
// need fqName to be something like android.hardware.foo@1.0.
// name and valueName is ignored.
if (fqName.package().empty() || fqName.version().empty()) {
- LOG(ERROR) << "Cannot enforce restrictions on package " << fqName.string()
- << ": package or version is missing.";
+ std::cerr << "ERROR: Cannot enforce restrictions on package " << fqName.string()
+ << ": package or version is missing." << std::endl;
return BAD_VALUE;
}
@@ -486,8 +483,8 @@ status_t Coordinator::enforceRestrictionsOnPackage(const FQName& fqName,
status_t Coordinator::enforceMinorVersionUprevs(const FQName &currentPackage) const {
if(!currentPackage.hasVersion()) {
- LOG(ERROR) << "Cannot enforce minor version uprevs for " << currentPackage.string()
- << ": missing version.";
+ std::cerr << "ERROR: Cannot enforce minor version uprevs for " << currentPackage.string()
+ << ": missing version." << std::endl;
return UNKNOWN_ERROR;
}
@@ -511,9 +508,10 @@ status_t Coordinator::enforceMinorVersionUprevs(const FQName &currentPackage) co
}
if (prevPackage != currentPackage.downRev()) {
- LOG(ERROR) << "Cannot enforce minor version uprevs for " << currentPackage.string()
- << ": Found package " << prevPackage.string() << " but missing "
- << currentPackage.downRev().string() << "; you cannot skip a minor version.";
+ std::cerr << "ERROR: Cannot enforce minor version uprevs for " << currentPackage.string()
+ << ": Found package " << prevPackage.string() << " but missing "
+ << currentPackage.downRev().string() << "; you cannot skip a minor version."
+ << std::endl;
return UNKNOWN_ERROR;
}
@@ -545,13 +543,14 @@ status_t Coordinator::enforceMinorVersionUprevs(const FQName &currentPackage) co
}
if (iface == nullptr) {
if (currentAST == nullptr) {
- LOG(WARNING) << "Warning: Skipping " << currentFQName.string()
- << " because it could not be found or parsed"
- << " or " << currentPackage.string()
- << " doesn't pass all requirements.";
+ std::cerr << "WARNING: Skipping " << currentFQName.string()
+ << " because it could not be found or parsed"
+ << " or " << currentPackage.string() << " doesn't pass all requirements."
+ << std::endl;
} else {
- LOG(WARNING) << "Warning: Skipping " << currentFQName.string()
- << " because the file might contain more than one interface.";
+ std::cerr << "WARNING: Skipping " << currentFQName.string()
+ << " because the file might contain more than one interface."
+ << std::endl;
}
continue;
}
@@ -578,10 +577,11 @@ status_t Coordinator::enforceMinorVersionUprevs(const FQName &currentPackage) co
bool lastFQNameExists = lastAST != nullptr && lastAST->getInterface() != nullptr;
if (iface->superType()->fqName() != lastFQName && lastFQNameExists) {
- LOG(ERROR) << "Cannot enforce minor version uprevs for " << currentPackage.string()
- << ": " << iface->fqName().string() << " extends "
- << iface->superType()->fqName().string()
- << ", which is not allowed. It must extend " << lastFQName.string();
+ std::cerr << "ERROR: Cannot enforce minor version uprevs for "
+ << currentPackage.string() << ": " << iface->fqName().string() << " extends "
+ << iface->superType()->fqName().string()
+ << ", which is not allowed. It must extend " << lastFQName.string()
+ << std::endl;
return UNKNOWN_ERROR;
}
@@ -590,14 +590,18 @@ status_t Coordinator::enforceMinorVersionUprevs(const FQName &currentPackage) co
extendedInterface = true;
}
- LOG(VERBOSE) << "enforceMinorVersionUprevs: " << currentFQName.string() << " passes.";
+ if (mVerbose) {
+ std::cout << "VERBOSE: EnforceMinorVersionUprevs: " << currentFQName.string()
+ << " passes." << std::endl;
+ }
}
if (!extendedInterface) {
// No interface extends the interface with the same name in @x.(y-1).
- LOG(ERROR) << currentPackage.string() << " doesn't pass minor version uprev requirement. "
- << "Requires at least one interface to extend an interface with the same name "
- << "from " << prevPackage.string() << ".";
+ std::cerr << "ERROR: " << currentPackage.string()
+ << " doesn't pass minor version uprev requirement. "
+ << "Requires at least one interface to extend an interface with the same name "
+ << "from " << prevPackage.string() << "." << std::endl;
return UNKNOWN_ERROR;
}
@@ -625,7 +629,7 @@ status_t Coordinator::enforceHashes(const FQName &currentPackage) const {
std::vector<std::string> frozen = Hash::lookupHash(hashPath, currentFQName.string(), &error);
if (error.size() > 0) {
- LOG(ERROR) << error;
+ std::cerr << "ERROR: " << error << std::endl;
err = UNKNOWN_ERROR;
continue;
}
@@ -640,9 +644,9 @@ status_t Coordinator::enforceHashes(const FQName &currentPackage) const {
std::string currentHash = Hash::getHash(ast->getFilename()).hexString();
if(std::find(frozen.begin(), frozen.end(), currentHash) == frozen.end()) {
- LOG(ERROR) << currentFQName.string() << " has hash " << currentHash
- << " which does not match hash on record. This interface has "
- << "been frozen. Do not change it!";
+ std::cerr << "ERROR: " << currentFQName.string() << " has hash " << currentHash
+ << " which does not match hash on record. This interface has "
+ << "been frozen. Do not change it!" << std::endl;
err = UNKNOWN_ERROR;
continue;
}
diff --git a/FmqType.cpp b/FmqType.cpp
index be4950ee..f5eaaa68 100644
--- a/FmqType.cpp
+++ b/FmqType.cpp
@@ -168,9 +168,9 @@ std::string FmqType::getVtsType() const {
return "TYPE_FMQ_SYNC";
} else if (mName == "MQDescriptorUnsync") {
return "TYPE_FMQ_UNSYNC";
- } else {
- LOG(ERROR) << "Invalid fmq type name.\n";
}
+
+ CHECK(false) << "Invalid FmqType.";
return "";
}
diff --git a/Interface.cpp b/Interface.cpp
index dac66692..e9e1c8f7 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -444,8 +444,8 @@ static std::map<std::string, Method *> gAllReservedMethods;
bool Interface::addMethod(Method *method) {
if (isIBase()) {
if (!gAllReservedMethods.emplace(method->name(), method).second) {
- LOG(ERROR) << "ERROR: hidl-gen encountered duplicated reserved method "
- << method->name();
+ std::cerr << "ERROR: hidl-gen encountered duplicated reserved method " << method->name()
+ << std::endl;
return false;
}
// will add it in addAllReservedMethods
@@ -510,7 +510,7 @@ status_t Interface::resolveInheritance() {
if (serial > LAST_CALL_TRANSACTION) {
std::cerr << "ERROR: More than " << LAST_CALL_TRANSACTION
<< " methods (including super and reserved) are not allowed at " << location()
- << "\n";
+ << std::endl;
return UNKNOWN_ERROR;
}
@@ -525,7 +525,8 @@ status_t Interface::validate() const {
CHECK(isIBase() == mSuperType.isEmptyReference());
if (!isIBase() && !mSuperType->isInterface()) {
- std::cerr << "ERROR: You can only extend interfaces at " << mSuperType.location() << "\n";
+ std::cerr << "ERROR: You can only extend interfaces at " << mSuperType.location()
+ << std::endl;
return UNKNOWN_ERROR;
}
@@ -559,7 +560,7 @@ status_t Interface::validateUniqueNames() const {
std::cerr << "ERROR: Redefinition of method '" << method->name()
<< "' defined in interface '" << definedInType->fullName() << "'";
}
- std::cerr << " at " << method->location() << "\n";
+ std::cerr << " at " << method->location() << std::endl;
return UNKNOWN_ERROR;
}
@@ -586,15 +587,14 @@ bool Interface::addAllReservedMethods() {
|| fillDebugMethod(method);
if (!fillSuccess) {
- LOG(ERROR) << "ERROR: hidl-gen does not recognize a reserved method "
- << method->name();
+ std::cerr << "ERROR: hidl-gen does not recognize a reserved method " << method->name()
+ << std::endl;
return false;
}
if (!reservedMethodsById.emplace(method->getSerialId(), method).second) {
- LOG(ERROR) << "ERROR: hidl-gen uses duplicated serial id for "
- << method->name() << " and "
- << reservedMethodsById[method->getSerialId()]->name()
- << ", serialId = " << method->getSerialId();
+ std::cerr << "ERROR: hidl-gen uses duplicated serial id for " << method->name()
+ << " and " << reservedMethodsById[method->getSerialId()]->name()
+ << ", serialId = " << method->getSerialId() << std::endl;
return false;
}
}
@@ -937,10 +937,11 @@ status_t Interface::emitVtsMethodDeclaration(Formatter &out) const {
}
}
} else {
- std::cerr << "Unrecognized annotation '"
- << name << "' for method: " << method->name()
+ std::cerr << "ERROR: Unrecognized annotation '" << name
+ << "' for method: " << method->name()
<< ". A VTS annotation should be one of: "
- << "entry, exit, callflow. \n";
+ << "entry, exit, callflow." << std::endl;
+ return UNKNOWN_ERROR;
}
out.unindent();
out << "}\n";
diff --git a/Scope.cpp b/Scope.cpp
index 8f7958e6..b09e3f59 100644
--- a/Scope.cpp
+++ b/Scope.cpp
@@ -42,7 +42,7 @@ status_t Scope::validateUniqueNames() const {
for (const auto* type : mTypes) {
if (mTypes[mTypeIndexByName.at(type->localName())] != type) {
std::cerr << "ERROR: A type named '" << type->localName()
- << "' is already declared in the scope at " << type->location() << "\n";
+ << "' is already declared in the scope at " << type->location() << std::endl;
return UNKNOWN_ERROR;
}
}
@@ -52,7 +52,7 @@ status_t Scope::validateUniqueNames() const {
NamedType *Scope::lookupType(const FQName &fqName) const {
CHECK(fqName.package().empty() && fqName.version().empty());
if (!fqName.valueName().empty()) {
- LOG(WARNING) << fqName.string() << " does not refer to a type.";
+ std::cerr << "ERROR: " << fqName.string() << " does not refer to a type." << std::endl;
return nullptr;
}
std::vector<std::string> names = fqName.names();
diff --git a/generateCpp.cpp b/generateCpp.cpp
index e49a067f..6822090d 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -2007,7 +2007,7 @@ void AST::generateCppAtraceCall(Formatter &out,
}
default:
{
- LOG(FATAL) << "Unsupported instrumentation event: " << event;
+ CHECK(false) << "Unsupported instrumentation event: " << event;
}
}
}
@@ -2089,7 +2089,7 @@ void AST::generateCppInstrumentationCall(
}
default:
{
- LOG(FATAL) << "Unsupported instrumentation event: " << event;
+ CHECK(false) << "Unsupported instrumentation event: " << event;
}
}