Commit 98da9667 by Jim Stichnoth

Subzero: Enable errors for unused parameters.

Uses pragmas when including problematic LLVM headers, so that clang doesn't warn about unused parameters -- a rampant problem in the LLVM code. This way, we can increase clang's pickiness on Subzero code, and also not drown in LLVM warnings. BUG= none R=jpp@chromium.org, jvoung@chromium.org Review URL: https://codereview.chromium.org/1217433002
parent a054f0ac
...@@ -162,7 +162,7 @@ SB_TRANSLATE := $(PNACL_BIN_PATH)/pnacl-translate ...@@ -162,7 +162,7 @@ SB_TRANSLATE := $(PNACL_BIN_PATH)/pnacl-translate
BASE_CXXFLAGS := -std=gnu++11 -Wall -Wextra -Werror -fno-rtti \ BASE_CXXFLAGS := -std=gnu++11 -Wall -Wextra -Werror -fno-rtti \
-fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g -pedantic \ -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g -pedantic \
-Wno-error=unused-parameter $(CXX_EXTRA) $(CXX_EXTRA)
CXXFLAGS := $(LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(CXX_DEFINES) $(HOST_FLAGS) \ CXXFLAGS := $(LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(CXX_DEFINES) $(HOST_FLAGS) \
$(STDLIB_FLAGS) $(STDLIB_FLAGS)
......
...@@ -16,7 +16,11 @@ ...@@ -16,7 +16,11 @@
#include "IceClFlags.h" #include "IceClFlags.h"
#include "IceClFlagsExtra.h" #include "IceClFlagsExtra.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#pragma clang diagnostic pop
namespace cl = llvm::cl; namespace cl = llvm::cl;
......
...@@ -15,7 +15,11 @@ ...@@ -15,7 +15,11 @@
#define SUBZERO_SRC_ICECLFLAGSEXTRA_H #define SUBZERO_SRC_ICECLFLAGSEXTRA_H
#include "IceDefs.h" #include "IceDefs.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#include "llvm/IRReader/IRReader.h" #include "llvm/IRReader/IRReader.h"
#pragma clang diagnostic pop
namespace Ice { namespace Ice {
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
#include "IceClFlagsExtra.h" #include "IceClFlagsExtra.h"
#include "IceELFStreamer.h" #include "IceELFStreamer.h"
#include "IceGlobalContext.h" #include "IceGlobalContext.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
// Include code to handle converting textual bitcode records to binary (for // Include code to handle converting textual bitcode records to binary (for
// INPUT_IS_TEXTUAL_BITCODE). // INPUT_IS_TEXTUAL_BITCODE).
#include "llvm/Bitcode/NaCl/NaClBitcodeMungeUtils.h" #include "llvm/Bitcode/NaCl/NaClBitcodeMungeUtils.h"
...@@ -25,6 +28,7 @@ ...@@ -25,6 +28,7 @@
#include "llvm/Support/Signals.h" #include "llvm/Support/Signals.h"
#include "llvm/Support/SourceMgr.h" #include "llvm/Support/SourceMgr.h"
#include "llvm/Support/StreamingMemoryObject.h" #include "llvm/Support/StreamingMemoryObject.h"
#pragma clang diagnostic pop
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
......
...@@ -23,12 +23,16 @@ ...@@ -23,12 +23,16 @@
#include "IceConverter.h" #include "IceConverter.h"
#include "IceELFObjectWriter.h" #include "IceELFObjectWriter.h"
#include "PNaClTranslator.h" #include "PNaClTranslator.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/IR/LLVMContext.h" #include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h" #include "llvm/IR/Module.h"
#include "llvm/IRReader/IRReader.h" #include "llvm/IRReader/IRReader.h"
#include "llvm/Support/SourceMgr.h" #include "llvm/Support/SourceMgr.h"
#include "llvm/Support/StreamingMemoryObject.h" #include "llvm/Support/StreamingMemoryObject.h"
#pragma clang diagnostic pop
namespace Ice { namespace Ice {
......
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
#include "IceTargetLowering.h" #include "IceTargetLowering.h"
#include "IceTypes.h" #include "IceTypes.h"
#include "IceTypeConverter.h" #include "IceTypeConverter.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#include "llvm/IR/Constant.h" #include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h" #include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h" #include "llvm/IR/DataLayout.h"
...@@ -31,6 +34,7 @@ ...@@ -31,6 +34,7 @@
#include "llvm/IR/Instructions.h" #include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h" #include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h" #include "llvm/IR/Module.h"
#pragma clang diagnostic pop
// TODO(kschimpf): Remove two namespaces being visible at once. // TODO(kschimpf): Remove two namespaces being visible at once.
using namespace llvm; using namespace llvm;
......
...@@ -24,7 +24,11 @@ ...@@ -24,7 +24,11 @@
#include "IceTargetLowering.h" #include "IceTargetLowering.h"
#include "IceTimerTree.h" #include "IceTimerTree.h"
#include "IceTypes.h" #include "IceTypes.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#include "llvm/Support/Timer.h" #include "llvm/Support/Timer.h"
#pragma clang diagnostic pop
#include <algorithm> // max() #include <algorithm> // max()
#include <cctype> // isdigit(), isupper() #include <cctype> // isdigit(), isupper()
......
...@@ -20,9 +20,13 @@ ...@@ -20,9 +20,13 @@
#include "IceDefs.h" #include "IceDefs.h"
#include "IceGlobalContext.h" #include "IceGlobalContext.h"
#include "IceTypes.h" #include "IceTypes.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#include "llvm/Bitcode/NaCl/NaClBitcodeParser.h" // for NaClBitcodeRecord. #include "llvm/Bitcode/NaCl/NaClBitcodeParser.h" // for NaClBitcodeRecord.
#include "llvm/IR/CallingConv.h" #include "llvm/IR/CallingConv.h"
#include "llvm/IR/GlobalValue.h" // for GlobalValue::LinkageTypes. #include "llvm/IR/GlobalValue.h" // for GlobalValue::LinkageTypes.
#pragma clang diagnostic pop
#include <memory> #include <memory>
#include <utility> #include <utility>
......
...@@ -15,7 +15,11 @@ ...@@ -15,7 +15,11 @@
#include "IceTimerTree.h" #include "IceTimerTree.h"
#include "IceDefs.h" #include "IceDefs.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#include "llvm/Support/Timer.h" #include "llvm/Support/Timer.h"
#pragma clang diagnostic pop
namespace Ice { namespace Ice {
......
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
#include "IceGlobalInits.h" #include "IceGlobalInits.h"
#include "IceInst.h" #include "IceInst.h"
#include "IceOperand.h" #include "IceOperand.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
#include "llvm/Bitcode/NaCl/NaClBitcodeDecoders.h" #include "llvm/Bitcode/NaCl/NaClBitcodeDecoders.h"
#include "llvm/Bitcode/NaCl/NaClBitcodeDefs.h" #include "llvm/Bitcode/NaCl/NaClBitcodeDefs.h"
...@@ -32,6 +35,7 @@ ...@@ -32,6 +35,7 @@
#include "llvm/Support/Format.h" #include "llvm/Support/Format.h"
#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#pragma clang diagnostic pop
namespace { namespace {
using namespace llvm; using namespace llvm;
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
#ifndef SUBZERO_UNITTEST_BITCODEMUNGE_H #ifndef SUBZERO_UNITTEST_BITCODEMUNGE_H
#define SUBZERO_UNITTEST_BITCODEMUNGE_H #define SUBZERO_UNITTEST_BITCODEMUNGE_H
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#include "llvm/Bitcode/NaCl/NaClBitcodeMunge.h" #include "llvm/Bitcode/NaCl/NaClBitcodeMunge.h"
#pragma clang diagnostic pop
#include "IceClFlags.h" #include "IceClFlags.h"
......
...@@ -9,9 +9,12 @@ ...@@ -9,9 +9,12 @@
#include <string> #include <string>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/Bitcode/NaCl/NaClBitcodeParser.h" #include "llvm/Bitcode/NaCl/NaClBitcodeParser.h"
#include "llvm/Bitcode/NaCl/NaClLLVMBitCodes.h" #include "llvm/Bitcode/NaCl/NaClLLVMBitCodes.h"
#pragma clang diagnostic pop
#include "BitcodeMunge.h" #include "BitcodeMunge.h"
#include "unittests/Bitcode/NaClMungeTest.h" #include "unittests/Bitcode/NaClMungeTest.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment