Hide compiler warnings from external includes

This commit is contained in:
Itms 2025-07-05 16:04:08 +02:00
parent aca798b318
commit 2d6d510ffa
No known key found for this signature in database
GPG key ID: C7E52BD14CE14E09
13 changed files with 7 additions and 190 deletions

View file

@ -234,10 +234,6 @@ function project_set_build_flags()
end
sanitize(sanitizers)
if os.istarget("windows") then
warnings "Extra"
end
-- disable Windows debug heap, since it makes malloc/free hugely slower when
-- running inside a debugger
if os.istarget("windows") then
@ -286,6 +282,9 @@ function project_set_build_flags()
defines { "CONFIG2_DAP_INTERFACE=0" }
end
-- hide warnings caused by library includes
externalwarnings "Off"
-- various platform-specific build flags
if os.istarget("windows") then
@ -299,6 +298,9 @@ function project_set_build_flags()
-- use native wchar_t type (not typedef to unsigned short)
nativewchar "on"
-- enable most of the standard warnings
warnings "Extra"
-- FIXME: conversion warnings, should add -Wconversion to gcc and clang flags as well
disablewarnings { "4267" }

View file

@ -58,13 +58,7 @@
#include <algorithm>
#include <js/CallAndConstruct.h>
#if MSC_VERSION
# pragma warning(push, 1)
#endif
#include <js/Promise.h>
#if MSC_VERSION
# pragma warning(pop)
#endif
#include <js/ValueArray.h>
#include <optional>
#include <SDL_events.h>

View file

@ -21,15 +21,8 @@
#include "lib/code_annotation.h"
#include "ps/CStr.h"
#if MSC_VERSION
# pragma warning(push, 1)
# pragma warning(disable: 4068)
# pragma warning(disable: 4100)
#endif
#include <js/TypeDecls.h>
#if MSC_VERSION
# pragma warning(pop)
#endif
#include <utility>
class IGUIObject;

View file

@ -47,13 +47,7 @@
#include <iterator>
#include <js/Equality.h>
#include <js/GCVector.h>
#if MSC_VERSION
# pragma warning(push, 1)
#endif
#include <js/Promise.h>
#if MSC_VERSION
# pragma warning(pop)
#endif
#include <js/PropertyAndElement.h>
#include <js/RootingAPI.h>
#include <js/String.h>

View file

@ -54,13 +54,7 @@
#include <tuple>
#include <variant>
#if MSC_VERSION
# pragma warning(push, 1)
#endif
#include "js/Promise.h"
#if MSC_VERSION
# pragma warning(pop)
#endif
class TestGuiManager : public CxxTest::TestSuite
{

View file

@ -21,15 +21,7 @@
#include "lib/types.h"
#include <cstddef>
#if MSC_VERSION
# pragma warning(push, 1)
# pragma warning(disable: 4068)
# pragma warning(disable: 4100)
#endif
#include <js/TypeDecls.h>
#if MSC_VERSION
# pragma warning(pop)
#endif
#include <libxml/parser.h>
#include <memory>
#include <string>

View file

@ -29,23 +29,8 @@
#include <string>
// Ignore warnings in SM headers.
#if GCC_VERSION || CLANG_VERSION
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#elif MSC_VERSION
# pragma warning(push, 1)
#endif
#include "js/JSON.h"
#if GCC_VERSION || CLANG_VERSION
# pragma GCC diagnostic pop
#elif MSC_VERSION
# pragma warning(pop)
#endif
bool Script::ParseJSON(const ScriptRequest& rq, const std::string& string_utf8, JS::MutableHandleValue out)
{
std::wstring attrsW = wstring_from_utf8(string_utf8);

View file

@ -18,14 +18,7 @@
#ifndef INCLUDED_SCRIPTINTERFACE_JOBQUEUE
#define INCLUDED_SCRIPTINTERFACE_JOBQUEUE
#if MSC_VERSION
# pragma warning(push, 1)
# pragma warning(disable: 4068)
#endif
#include "js/Promise.h"
#if MSC_VERSION
# pragma warning(pop)
#endif
#include <queue>

View file

@ -24,24 +24,6 @@
#include "scriptinterface/ScriptTypes.h"
// Ignore some harmless warnings
#if GCC_VERSION
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
# pragma GCC diagnostic ignored "-Wredundant-decls"
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#endif
#if CLANG_VERSION
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wmismatched-tags"
#endif
#if MSC_VERSION
// reduce the warning level for the SpiderMonkey headers
# pragma warning(push, 1)
// ignore C4291 in <mozilla/Maybe.h>
# pragma warning(disable: 4291)
#endif
// Redefine signbit to fix build error in GCC
#ifndef signbit
# define signbit std::signbit
@ -68,14 +50,4 @@
#undef signbit
#if MSC_VERSION
# pragma warning(pop)
#endif
#if CLANG_VERSION
# pragma clang diagnostic pop
#endif
#if GCC_VERSION
# pragma GCC diagnostic pop
#endif
#endif // INCLUDED_SCRIPTEXTRAHEADERS

View file

@ -18,23 +18,6 @@
#ifndef INCLUDED_SCRIPTFORWARD
#define INCLUDED_SCRIPTFORWARD
// Ignore some harmless warnings
#if GCC_VERSION
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#if CLANG_VERSION
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wunused-parameter"
#endif
#if MSC_VERSION
# pragma warning(push, 1)
# pragma warning(disable: 4100)
# pragma warning(disable: 4068)
#endif
#include "js/TypeDecls.h"
// Complete with a few additional ones.
@ -51,15 +34,4 @@ class ScriptContext;
class ScriptInterface;
class ScriptRequest;
#if GCC_VERSION
# pragma GCC diagnostic pop
#endif
#if CLANG_VERSION
# pragma clang diagnostic pop
#endif
#if MSC_VERSION
# pragma warning(pop)
#endif
#endif // INCLUDED_SCRIPTFORWARD

View file

@ -20,23 +20,8 @@
#include "scriptinterface/ScriptForward.h"
// Ignore warnings in SM headers.
#if GCC_VERSION || CLANG_VERSION
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#elif MSC_VERSION
# pragma warning(push, 1)
#endif
#include "js/RootingAPI.h"
#if GCC_VERSION || CLANG_VERSION
# pragma GCC diagnostic pop
#elif MSC_VERSION
# pragma warning(pop)
#endif
#include <memory>
class ScriptInterface;

View file

@ -32,53 +32,9 @@
# endif
#endif
// Ignore some harmless warnings
#if GCC_VERSION
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
# pragma GCC diagnostic ignored "-Wredundant-decls"
# pragma GCC diagnostic ignored "-Wundef" // Some versions of GCC will still print warnings (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431).
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
# pragma GCC diagnostic ignored "-Wignored-qualifiers"
# pragma GCC diagnostic ignored "-Wextra"
#endif
#if CLANG_VERSION
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wuninitialized"
# pragma clang diagnostic ignored "-Wc++11-extensions"
# pragma clang diagnostic ignored "-Wignored-qualifiers"
# pragma clang diagnostic ignored "-Wmismatched-tags"
// Ugly hack to deal with macro redefinitions from libc++
# ifdef nullptr
# undef nullptr
# endif
# ifdef decltype
# undef decltype
# endif
#endif
#if MSC_VERSION
// reduce the warning level for the SpiderMonkey headers
# pragma warning(push, 1)
// ignore C4291 in <mozilla/Vector.h>
# pragma warning(disable: 4291)
// ignore C4068 in <mozilla/Casting.h>
# pragma warning(disable: 4068)
#endif
#include "jspubtd.h"
#include "jsapi.h"
// restore user flags and re-enable the warnings disabled a few lines above
#if MSC_VERSION
# pragma warning(pop)
#endif
#if CLANG_VERSION
# pragma clang diagnostic pop
#endif
#if GCC_VERSION
# pragma GCC diagnostic pop
#endif
#if MOZJS_MAJOR_VERSION != 115
#error Your compiler is trying to use an incorrect major version of the \
SpiderMonkey library. The SpiderMonkey API is subject to changes, and the \

View file

@ -23,23 +23,8 @@
#include "ScriptRequest.h"
#include "StructuredClone.h"
// Ignore warnings in SM headers.
#if GCC_VERSION || CLANG_VERSION
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#elif MSC_VERSION
# pragma warning(push, 1)
#endif
#include "js/StructuredClone.h"
#if GCC_VERSION || CLANG_VERSION
# pragma GCC diagnostic pop
#elif MSC_VERSION
# pragma warning(pop)
#endif
Script::StructuredClone Script::WriteStructuredClone(const ScriptRequest& rq, JS::HandleValue v)
{
Script::StructuredClone ret(new JSStructuredCloneData(JS::StructuredCloneScope::SameProcess));