Skip to content

Commit

Permalink
Fix scan-build setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ansaya committed Jun 13, 2024
1 parent 6139144 commit 4cdf295
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 18 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ appimage: appimage-setup build

### Scan build
scan-build: run-configure
@make --directory=$(BUILD_DIR)/ext -j$(J)
@scan-build$(SCAN_BUILD_VERSION) -v -v -o $(SCAN_BUILD_REPORT_DIR) make --directory=build/src -j$(J)
@make --directory=build/ext -j$(J)
@scan-build$(SCAN_BUILD_VERSION) -v -v \
--use-analyzer=$(shell which clang$(SCAN_BUILD_VERSION)) \
--use-cc=$(shell which clang$(SCAN_BUILD_VERSION)) \
--use-c++=$(shell which clang++$(SCAN_BUILD_VERSION)) \
-o $(SCAN_BUILD_REPORT_DIR) make --directory=build/src -j$(J)

clean:
@if [ -e $(BUILD_DIR)/Makefile ]; then make --directory=$(BUILD_DIR) clean; fi
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1444,6 +1444,7 @@ if test "x$panda_WERROR" = xyes; then
AX_CXXFLAGS_GCC_OPTION(-Wuse-after-free,, CXXFLAGS+=" -Wuse-after-free -Wno-error=use-after-free ",)

AX_CHECK_COMPILE_FLAG("-Wpedantic", CXXFLAGS+=" -Wpedantic ",,"-Werror")
AX_CHECK_COMPILE_FLAG("-Wmismatched-tags", CXXFLAGS+=" -Wno-mismatched-tags ",,"-Werror")
# AX_CHECK_COMPILE_FLAG("-Woverlength-strings", CXXFLAGS+=" -Wno-overlength-strings ",,"-Werror")
else
CXXFLAGS+=" -w "
Expand Down
17 changes: 17 additions & 0 deletions src/HLS/simulation/c_initialization_yparser.ypp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ REF_FORWARD_DECL(CInitializationLexer);
#endif

///Skipping warnings due to bison
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wsign-conversion"
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wwrite-strings"
#pragma clang diagnostic ignored "-Wold-style-cast"
#pragma clang diagnostic ignored "-Wredundant-decls"
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#if __has_warning("-Wunused-but-set-variable")
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#endif
#if __has_warning("-Wzero-as-null-pointer-constant")
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#else
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wunused-parameter"
Expand All @@ -78,6 +93,8 @@ REF_FORWARD_DECL(CInitializationLexer);
#pragma GCC diagnostic ignored "-Wredundant-decls"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif

/**
* Class declarations
Expand Down
15 changes: 14 additions & 1 deletion src/parser/aadl/aadl_yparser.ypp
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,27 @@ REF_FORWARD_DECL(AadlFlexLexer);
#include "aadl_lexer.hpp"

///Skipping warnings due to bison
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wsign-conversion"
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wwrite-strings"
#pragma clang diagnostic ignored "-Wold-style-cast"
#pragma clang diagnostic ignored "-Wredundant-decls"
#if __has_warning("-Wunused-but-set-variable")
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#endif
#if __has_warning("-Wzero-as-null-pointer-constant")
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#else
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wwrite-strings"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wredundant-decls"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || (defined(__clang__) && __clang_major__ >= 6)
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
/**
Expand Down
15 changes: 14 additions & 1 deletion src/parser/asn/asn_yparser.ypp
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,27 @@ REF_FORWARD_DECL(AsnFlexLexer);
#include "asn_lexer.hpp"

///Skipping warnings due to bison
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wsign-conversion"
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wwrite-strings"
#pragma clang diagnostic ignored "-Wold-style-cast"
#pragma clang diagnostic ignored "-Wredundant-decls"
#if __has_warning("-Wunused-but-set-variable")
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#endif
#if __has_warning("-Wzero-as-null-pointer-constant")
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#else
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wwrite-strings"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wredundant-decls"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || (defined(__clang__) && __clang_major__ >= 6)
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif

Expand Down
15 changes: 14 additions & 1 deletion src/parser/compiler/treeParser.ypp
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,27 @@ REF_FORWARD_DECL(TreeFlexLexer);
*/
//#define NDEBUG 1
///Skipping warnings due to bison
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wsign-conversion"
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wwrite-strings"
#pragma clang diagnostic ignored "-Wold-style-cast"
#pragma clang diagnostic ignored "-Wredundant-decls"
#if __has_warning("-Wunused-but-set-variable")
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#endif
#if __has_warning("-Wzero-as-null-pointer-constant")
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#else
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wwrite-strings"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wredundant-decls"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || (defined(__clang__) && __clang_major__ >= 6)
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
/**
Expand Down
18 changes: 15 additions & 3 deletions src/parser/discrepancy/discrepancyParser.ypp
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,27 @@ REF_FORWARD_DECL(Discrepancy);
#include "string_manipulation.hpp" // for STR

// Skipping warnings due to bison
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wsign-conversion"
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wwrite-strings"
#pragma clang diagnostic ignored "-Wold-style-cast"
#pragma clang diagnostic ignored "-Wredundant-decls"
#if __has_warning("-Wunused-but-set-variable")
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#endif
#if __has_warning("-Wzero-as-null-pointer-constant")
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#else
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wredundant-decls"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wwrite-strings"
#pragma GCC diagnostic ignored "-Wswitch-default"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wredundant-decls"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif

Expand Down
15 changes: 14 additions & 1 deletion src/parser/polixml/xmlParser.ypp
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,27 @@ REF_FORWARD_DECL(xml_document);
* Defines
*/
///Skipping warnings due to bison
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wsign-conversion"
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wwrite-strings"
#pragma clang diagnostic ignored "-Wold-style-cast"
#pragma clang diagnostic ignored "-Wredundant-decls"
#if __has_warning("-Wunused-but-set-variable")
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#endif
#if __has_warning("-Wzero-as-null-pointer-constant")
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#else
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wwrite-strings"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wredundant-decls"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || (defined(__clang__) && __clang_major__ >= 6)
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
/**
Expand Down
13 changes: 9 additions & 4 deletions src/utility/custom_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
#pragma clang diagnostic ignored "-Wdouble-promotion"
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma clang diagnostic ignored "-Wextra-semi"
#pragma clang diagnostic ignored "-Wshadow"
#if __has_warning("-Wdeprecated-builtins")
#pragma clang diagnostic ignored "-Wdeprecated-builtins"
#endif
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
Expand All @@ -63,12 +67,13 @@
#pragma GCC diagnostic ignored "-Woverflow"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma GCC diagnostic ignored "-Wstrict-overflow"
#pragma GCC diagnostic ignored "-Wshadow"
#endif

#include "absl/container/btree_map.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/node_hash_map.h"
#include "absl/hash/hash.h"
#include <absl/container/btree_map.h>
#include <absl/container/flat_hash_map.h>
#include <absl/container/node_hash_map.h>
#include <absl/hash/hash.h>

#if defined(__clang__)
#pragma clang diagnostic pop
Expand Down
13 changes: 9 additions & 4 deletions src/utility/custom_set.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma clang diagnostic ignored "-Wextra-semi"
#pragma clang diagnostic ignored "-Wshadow"
#if __has_warning("-Wdeprecated-builtins")
#pragma clang diagnostic ignored "-Wdeprecated-builtins"
#endif
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
Expand All @@ -65,12 +69,13 @@
#pragma GCC diagnostic ignored "-Woverflow"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma GCC diagnostic ignored "-Wstrict-overflow"
#pragma GCC diagnostic ignored "-Wshadow"
#endif

#include "absl/container/btree_set.h"
#include "absl/container/flat_hash_set.h"
#include "absl/container/node_hash_set.h"
#include "absl/hash/hash.h"
#include <absl/container/btree_set.h>
#include <absl/container/flat_hash_set.h>
#include <absl/container/node_hash_set.h>
#include <absl/hash/hash.h>

#if defined(__clang__)
#pragma clang diagnostic pop
Expand Down
1 change: 0 additions & 1 deletion src/wrapper/compiler/compiler_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2331,7 +2331,6 @@ const std::string CompilerWrapper::AddSourceCodeIncludes(const std::list<std::st
std::string CompilerWrapper::clang_recipes(const CompilerWrapper_OptimizationSet optimization_set,
const std::string& fname) const
{
const auto& compiler = GetCompiler();
auto plugin_prefix = add_plugin_prefix(compiler_target);

const auto opt_level = WriteOptimizationLevel(optimization_set == CompilerWrapper_OptimizationSet::O0 ?
Expand Down

0 comments on commit 4cdf295

Please sign in to comment.