Skip to content

Commit

Permalink
Fix config issues and revert previous fixes for semi-colon issues
Browse files Browse the repository at this point in the history
This reverts commit 41261d9.
This reverts commit 7c9accb.

Instead of trying to work around all of the potential semicolon issues
in glslang, making it conform to Chromium's style, mark the code
explicitly as non-chromium in the BUILD.gn, so chromium doesn't
attempt to enforce its style rules on glslang.

Fixes #1931
  • Loading branch information
zoddicus committed Oct 15, 2019
1 parent b03e4fc commit 1aeceae
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 19 deletions.
15 changes: 13 additions & 2 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ source_set("glslang_sources") {
}

if (is_clang) {
cflags_cc = [
cflags = [
"-Wno-extra-semi",
"-Wno-ignored-qualifiers",
"-Wno-implicit-fallthrough",
Expand All @@ -168,7 +168,6 @@ source_set("glslang_sources") {
"-Wno-unused-variable",
"-Wno-missing-field-initializers",
"-Wno-newline-eof",
"-Wextra-semi",
]
}
if (is_win && !is_clang) {
Expand All @@ -182,6 +181,9 @@ source_set("glslang_sources") {
"${spirv_tools_dir}:spvtools_opt",
"${spirv_tools_dir}:spvtools_val",
]

configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}

source_set("glslang_default_resource_limits_sources") {
Expand All @@ -193,6 +195,9 @@ source_set("glslang_default_resource_limits_sources") {
":glslang_sources",
]
public_configs = [ ":glslang_public" ]

configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}

executable("glslang_validator") {
Expand All @@ -208,6 +213,9 @@ executable("glslang_validator") {
":glslang_default_resource_limits_sources",
":glslang_sources",
]

configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}

executable("spirv-remap") {
Expand All @@ -218,4 +226,7 @@ executable("spirv-remap") {
deps = [
":glslang_sources",
]

configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ endif(WIN32)

if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
add_compile_options(-Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs
-Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable -fno-exceptions)
-Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable -fno-exceptions)
add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over.
add_compile_options(-fno-rtti)
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs
-Wunused-parameter -Wunused-value -Wunused-variable -Wextra-semi)
-Wunused-parameter -Wunused-value -Wunused-variable)
add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over.
add_compile_options(-fno-rtti)
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC")
Expand Down
8 changes: 4 additions & 4 deletions SPIRV/GlslangToSpv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ struct OpDecorations {
spv::Decoration precision;

#ifdef GLSLANG_WEB
void addNoContraction(spv::Builder&, spv::Id) const { }
void addNonUniform(spv::Builder&, spv::Id) const { }
void addNoContraction(spv::Builder&, spv::Id) const { };
void addNonUniform(spv::Builder&, spv::Id) const { };
#else
void addNoContraction(spv::Builder& builder, spv::Id t) { builder.addDecoration(t, noContraction); }
void addNonUniform(spv::Builder& builder, spv::Id t) { builder.addDecoration(t, nonUniform); }
void addNoContraction(spv::Builder& builder, spv::Id t) { builder.addDecoration(t, noContraction); };
void addNonUniform(spv::Builder& builder, spv::Id t) { builder.addDecoration(t, nonUniform); };
protected:
spv::Decoration noContraction;
spv::Decoration nonUniform;
Expand Down
4 changes: 2 additions & 2 deletions glslang/Include/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
bool isYuv() const { return yuv; }
#endif
void setCombined(bool c) { combined = c; }
void setBasicType(TBasicType t) { type = t; }
TBasicType getBasicType() const { return type; }
void setBasicType(TBasicType t) { type = t; };
TBasicType getBasicType() const { return type; };
bool isShadow() const { return shadow; }
bool isArrayed() const { return arrayed; }

Expand Down
2 changes: 1 addition & 1 deletion glslang/MachineIndependent/ParseHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class TParseContext : public TParseContextBase {
const TString* entryPoint = nullptr);
virtual ~TParseContext();

bool obeyPrecisionQualifiers() const { return precisionManager.respectingPrecisionQualifiers(); }
bool obeyPrecisionQualifiers() const { return precisionManager.respectingPrecisionQualifiers(); };
void setPrecisionDefaults();

void setLimits(const TBuiltInResource&) override;
Expand Down
12 changes: 6 additions & 6 deletions glslang/MachineIndependent/iomapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver {
bool doAutoLocationMapping() const;
TSlotSet::iterator findSlot(int set, int slot);
bool checkEmpty(int set, int slot);
bool validateInOut(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; }
bool validateInOut(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; };
int reserveSlot(int set, int slot, int size = 1);
int getFreeSlot(int set, int base, int size = 1);
int resolveSet(EShLanguage /*stage*/, TVarEntryInfo& ent) override;
Expand All @@ -125,7 +125,7 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver {
void addStage(EShLanguage stage) override {
if (stage < EShLangCount)
stageMask[stage] = true;
}
};
uint32_t computeTypeLocationSize(const TType& type, EShLanguage stage);

TSlotSetMap slots;
Expand Down Expand Up @@ -191,7 +191,7 @@ struct TDefaultGlslIoResolver : public TDefaultIoResolverBase {
typedef std::map<TString, int> TVarSlotMap; // <resourceName, location/binding>
typedef std::map<int, TVarSlotMap> TSlotMap; // <resourceKey, TVarSlotMap>
TDefaultGlslIoResolver(const TIntermediate& intermediate);
bool validateBinding(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; }
bool validateBinding(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; };
TResourceType getResourceType(const glslang::TType& type) override;
int resolveInOutLocation(EShLanguage stage, TVarEntryInfo& ent) override;
int resolveUniformLocation(EShLanguage /*stage*/, TVarEntryInfo& ent) override;
Expand All @@ -209,7 +209,7 @@ struct TDefaultGlslIoResolver : public TDefaultIoResolverBase {
int buildStorageKey(EShLanguage stage, TStorageQualifier type) {
assert(static_cast<uint32_t>(stage) <= 0x0000ffff && static_cast<uint32_t>(type) <= 0x0000ffff);
return (stage << 16) | type;
}
};

protected:
// Use for mark pre stage, to get more interface symbol information.
Expand Down Expand Up @@ -242,7 +242,7 @@ struct TVarLivePair : std::pair<const TString, TVarEntryInfo> {
const_cast<TString&>(first) = _Right.first;
second = _Right.second;
return (*this);
}
};
};
typedef std::vector<TVarLivePair> TVarLiveVector;

Expand All @@ -253,7 +253,7 @@ class TIoMapper {
virtual ~TIoMapper() {}
// grow the reflection stage by stage
bool virtual addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*);
bool virtual doMap(TIoMapResolver*, TInfoSink&) { return true; }
bool virtual doMap(TIoMapResolver*, TInfoSink&) { return true; };
};

// I/O mapper for OpenGL
Expand Down
4 changes: 2 additions & 2 deletions glslang/Public/ShaderLang.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ class TShader {
environment.target.version = version;
}

void getStrings(const char* const* &s, int& n) { s = strings; n = numStrings; }
void getStrings(const char* const* &s, int& n) { s = strings; n = numStrings; };

#ifdef ENABLE_HLSL
void setEnvTargetHlslFunctionality1() { environment.target.hlslFunctionality1 = true; }
Expand Down Expand Up @@ -775,7 +775,7 @@ class TProgram {
TProgram();
virtual ~TProgram();
void addShader(TShader* shader) { stages[shader->stage].push_back(shader); }
std::list<TShader*>& getShaders(EShLanguage stage) { return stages[stage]; }
std::list<TShader*>& getShaders(EShLanguage stage) { return stages[stage]; };
// Link Validation interface
bool link(EShMessages);
const char* getInfoLog();
Expand Down

0 comments on commit 1aeceae

Please sign in to comment.