Skip to content

Commit d65c618

Browse files
1acecsyonghe
andauthored
Move -Werror to CI (shader-slang#2362)
* move -Werror to CI This allows people with a more up-to-date system than you to still compile your project, while still allowing you to block on every warning in your own development. * Fixes. * More fix. * more fix. * Disable werror for gcc. * Fix bash. * fix * fix yml Co-authored-by: Yong He <yonghe@outlook.com> Co-authored-by: Yong He <yhe@nvidia.com>
1 parent cbc7e62 commit d65c618

File tree

8 files changed

+15
-81
lines changed

8 files changed

+15
-81
lines changed

.github/workflows/linux.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ jobs:
2121
submodules: 'true'
2222
fetch-depth: '0'
2323
- name: build
24-
run:
24+
run: |
2525
CC=${{matrix.compiler}}
2626
CONFIGURATION=${{matrix.configuration}}
2727
ARCH=${{matrix.platform}}
28+
if [[ "$CC" == "clang" ]]; then
29+
CFLAGS=-Werror
30+
CPPFLAGS=-Werror
31+
CXXFLAGS=-Werror
32+
fi
2833
source ./github_build.sh
2934
- uses: actions/upload-artifact@v3
3035
with:

.github/workflows/macos.yml

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
CC=${{matrix.compiler}}
2828
CONFIGURATION=${{matrix.configuration}}
2929
ARCH=${{matrix.platform}}
30+
CPPFLAGS=-Werror
31+
CFLAGS=-Werror
32+
CXXFLAGS=-Werror
3033
source ./github_macos_build.sh
3134
- name: Package
3235
id: package

.github/workflows/windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
.\premake.bat vs2017 --enable-embed-stdlib=true --arch=${{matrix.platform}} --deps=true --no-progress=true
2929
- name: build
3030
run:
31-
MSBuild.exe slang.sln -v:m -m -property:Configuration=${{matrix.configuration}} -property:Platform=${{matrix.platform}} -property:WindowsTargetPlatformVersion=10.0.19041.0
31+
MSBuild.exe slang.sln -v:m -m -property:Configuration=${{matrix.configuration}} -property:Platform=${{matrix.platform}} -property:WindowsTargetPlatformVersion=10.0.19041.0 -warnAsError
3232
- uses: actions/upload-artifact@v3
3333
with:
3434
name: slang-build-${{matrix.configuration}}-${{matrix.platform}}-${{matrix.compiler}}

build/visual-studio/compiler-core/compiler-core.vcxproj

-24
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@
157157
<ClCompile>
158158
<PrecompiledHeader>NotUsing</PrecompiledHeader>
159159
<WarningLevel>Level4</WarningLevel>
160-
<TreatWarningAsError>true</TreatWarningAsError>
161160
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
162161
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
163162
<Optimization>Disabled</Optimization>
@@ -167,15 +166,11 @@
167166
<SubSystem>Windows</SubSystem>
168167
<GenerateDebugInformation>true</GenerateDebugInformation>
169168
</Link>
170-
<Lib>
171-
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
172-
</Lib>
173169
</ItemDefinitionGroup>
174170
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
175171
<ClCompile>
176172
<PrecompiledHeader>NotUsing</PrecompiledHeader>
177173
<WarningLevel>Level4</WarningLevel>
178-
<TreatWarningAsError>true</TreatWarningAsError>
179174
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
180175
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
181176
<Optimization>Disabled</Optimization>
@@ -185,15 +180,11 @@
185180
<SubSystem>Windows</SubSystem>
186181
<GenerateDebugInformation>true</GenerateDebugInformation>
187182
</Link>
188-
<Lib>
189-
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
190-
</Lib>
191183
</ItemDefinitionGroup>
192184
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'">
193185
<ClCompile>
194186
<PrecompiledHeader>NotUsing</PrecompiledHeader>
195187
<WarningLevel>Level4</WarningLevel>
196-
<TreatWarningAsError>true</TreatWarningAsError>
197188
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
198189
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
199190
<Optimization>Disabled</Optimization>
@@ -203,15 +194,11 @@
203194
<SubSystem>Windows</SubSystem>
204195
<GenerateDebugInformation>true</GenerateDebugInformation>
205196
</Link>
206-
<Lib>
207-
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
208-
</Lib>
209197
</ItemDefinitionGroup>
210198
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
211199
<ClCompile>
212200
<PrecompiledHeader>NotUsing</PrecompiledHeader>
213201
<WarningLevel>Level4</WarningLevel>
214-
<TreatWarningAsError>true</TreatWarningAsError>
215202
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
216203
<Optimization>Full</Optimization>
217204
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -225,15 +212,11 @@
225212
<EnableCOMDATFolding>true</EnableCOMDATFolding>
226213
<OptimizeReferences>true</OptimizeReferences>
227214
</Link>
228-
<Lib>
229-
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
230-
</Lib>
231215
</ItemDefinitionGroup>
232216
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
233217
<ClCompile>
234218
<PrecompiledHeader>NotUsing</PrecompiledHeader>
235219
<WarningLevel>Level4</WarningLevel>
236-
<TreatWarningAsError>true</TreatWarningAsError>
237220
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
238221
<Optimization>Full</Optimization>
239222
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -247,15 +230,11 @@
247230
<EnableCOMDATFolding>true</EnableCOMDATFolding>
248231
<OptimizeReferences>true</OptimizeReferences>
249232
</Link>
250-
<Lib>
251-
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
252-
</Lib>
253233
</ItemDefinitionGroup>
254234
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'">
255235
<ClCompile>
256236
<PrecompiledHeader>NotUsing</PrecompiledHeader>
257237
<WarningLevel>Level4</WarningLevel>
258-
<TreatWarningAsError>true</TreatWarningAsError>
259238
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
260239
<Optimization>Full</Optimization>
261240
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -269,9 +248,6 @@
269248
<EnableCOMDATFolding>true</EnableCOMDATFolding>
270249
<OptimizeReferences>true</OptimizeReferences>
271250
</Link>
272-
<Lib>
273-
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
274-
</Lib>
275251
</ItemDefinitionGroup>
276252
<ItemGroup>
277253
<ClInclude Include="..\..\..\source\compiler-core\slang-artifact-associated-impl.h" />

build/visual-studio/core/core.vcxproj

-24
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@
157157
<ClCompile>
158158
<PrecompiledHeader>NotUsing</PrecompiledHeader>
159159
<WarningLevel>Level4</WarningLevel>
160-
<TreatWarningAsError>true</TreatWarningAsError>
161160
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
162161
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
163162
<Optimization>Disabled</Optimization>
@@ -167,15 +166,11 @@
167166
<SubSystem>Windows</SubSystem>
168167
<GenerateDebugInformation>true</GenerateDebugInformation>
169168
</Link>
170-
<Lib>
171-
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
172-
</Lib>
173169
</ItemDefinitionGroup>
174170
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
175171
<ClCompile>
176172
<PrecompiledHeader>NotUsing</PrecompiledHeader>
177173
<WarningLevel>Level4</WarningLevel>
178-
<TreatWarningAsError>true</TreatWarningAsError>
179174
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
180175
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
181176
<Optimization>Disabled</Optimization>
@@ -185,15 +180,11 @@
185180
<SubSystem>Windows</SubSystem>
186181
<GenerateDebugInformation>true</GenerateDebugInformation>
187182
</Link>
188-
<Lib>
189-
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
190-
</Lib>
191183
</ItemDefinitionGroup>
192184
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'">
193185
<ClCompile>
194186
<PrecompiledHeader>NotUsing</PrecompiledHeader>
195187
<WarningLevel>Level4</WarningLevel>
196-
<TreatWarningAsError>true</TreatWarningAsError>
197188
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
198189
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
199190
<Optimization>Disabled</Optimization>
@@ -203,15 +194,11 @@
203194
<SubSystem>Windows</SubSystem>
204195
<GenerateDebugInformation>true</GenerateDebugInformation>
205196
</Link>
206-
<Lib>
207-
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
208-
</Lib>
209197
</ItemDefinitionGroup>
210198
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
211199
<ClCompile>
212200
<PrecompiledHeader>NotUsing</PrecompiledHeader>
213201
<WarningLevel>Level4</WarningLevel>
214-
<TreatWarningAsError>true</TreatWarningAsError>
215202
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
216203
<Optimization>Full</Optimization>
217204
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -225,15 +212,11 @@
225212
<EnableCOMDATFolding>true</EnableCOMDATFolding>
226213
<OptimizeReferences>true</OptimizeReferences>
227214
</Link>
228-
<Lib>
229-
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
230-
</Lib>
231215
</ItemDefinitionGroup>
232216
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
233217
<ClCompile>
234218
<PrecompiledHeader>NotUsing</PrecompiledHeader>
235219
<WarningLevel>Level4</WarningLevel>
236-
<TreatWarningAsError>true</TreatWarningAsError>
237220
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
238221
<Optimization>Full</Optimization>
239222
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -247,15 +230,11 @@
247230
<EnableCOMDATFolding>true</EnableCOMDATFolding>
248231
<OptimizeReferences>true</OptimizeReferences>
249232
</Link>
250-
<Lib>
251-
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
252-
</Lib>
253233
</ItemDefinitionGroup>
254234
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'">
255235
<ClCompile>
256236
<PrecompiledHeader>NotUsing</PrecompiledHeader>
257237
<WarningLevel>Level4</WarningLevel>
258-
<TreatWarningAsError>true</TreatWarningAsError>
259238
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
260239
<Optimization>Full</Optimization>
261240
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -269,9 +248,6 @@
269248
<EnableCOMDATFolding>true</EnableCOMDATFolding>
270249
<OptimizeReferences>true</OptimizeReferences>
271250
</Link>
272-
<Lib>
273-
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
274-
</Lib>
275251
</ItemDefinitionGroup>
276252
<ItemGroup>
277253
<ClInclude Include="..\..\..\source\core\slang-allocator.h" />

build/visual-studio/slang-rt/slang-rt.vcxproj

-12
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@
163163
<ClCompile>
164164
<PrecompiledHeader>NotUsing</PrecompiledHeader>
165165
<WarningLevel>Level4</WarningLevel>
166-
<TreatWarningAsError>true</TreatWarningAsError>
167166
<PreprocessorDefinitions>_DEBUG;SLANG_RT_DYNAMIC;SLANG_RT_DYNAMIC_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
168167
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
169168
<Optimization>Disabled</Optimization>
@@ -173,14 +172,12 @@
173172
<SubSystem>Windows</SubSystem>
174173
<GenerateDebugInformation>true</GenerateDebugInformation>
175174
<ImportLibrary>..\..\..\bin\windows-x86\debug\slang-rt.lib</ImportLibrary>
176-
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
177175
</Link>
178176
</ItemDefinitionGroup>
179177
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
180178
<ClCompile>
181179
<PrecompiledHeader>NotUsing</PrecompiledHeader>
182180
<WarningLevel>Level4</WarningLevel>
183-
<TreatWarningAsError>true</TreatWarningAsError>
184181
<PreprocessorDefinitions>_DEBUG;SLANG_RT_DYNAMIC;SLANG_RT_DYNAMIC_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
185182
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
186183
<Optimization>Disabled</Optimization>
@@ -190,14 +187,12 @@
190187
<SubSystem>Windows</SubSystem>
191188
<GenerateDebugInformation>true</GenerateDebugInformation>
192189
<ImportLibrary>..\..\..\bin\windows-x64\debug\slang-rt.lib</ImportLibrary>
193-
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
194190
</Link>
195191
</ItemDefinitionGroup>
196192
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'">
197193
<ClCompile>
198194
<PrecompiledHeader>NotUsing</PrecompiledHeader>
199195
<WarningLevel>Level4</WarningLevel>
200-
<TreatWarningAsError>true</TreatWarningAsError>
201196
<PreprocessorDefinitions>_DEBUG;SLANG_RT_DYNAMIC;SLANG_RT_DYNAMIC_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
202197
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
203198
<Optimization>Disabled</Optimization>
@@ -207,14 +202,12 @@
207202
<SubSystem>Windows</SubSystem>
208203
<GenerateDebugInformation>true</GenerateDebugInformation>
209204
<ImportLibrary>..\..\..\bin\windows-aarch64\debug\slang-rt.lib</ImportLibrary>
210-
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
211205
</Link>
212206
</ItemDefinitionGroup>
213207
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
214208
<ClCompile>
215209
<PrecompiledHeader>NotUsing</PrecompiledHeader>
216210
<WarningLevel>Level4</WarningLevel>
217-
<TreatWarningAsError>true</TreatWarningAsError>
218211
<PreprocessorDefinitions>NDEBUG;SLANG_RT_DYNAMIC;SLANG_RT_DYNAMIC_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
219212
<Optimization>Full</Optimization>
220213
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -228,14 +221,12 @@
228221
<EnableCOMDATFolding>true</EnableCOMDATFolding>
229222
<OptimizeReferences>true</OptimizeReferences>
230223
<ImportLibrary>..\..\..\bin\windows-x86\release\slang-rt.lib</ImportLibrary>
231-
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
232224
</Link>
233225
</ItemDefinitionGroup>
234226
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
235227
<ClCompile>
236228
<PrecompiledHeader>NotUsing</PrecompiledHeader>
237229
<WarningLevel>Level4</WarningLevel>
238-
<TreatWarningAsError>true</TreatWarningAsError>
239230
<PreprocessorDefinitions>NDEBUG;SLANG_RT_DYNAMIC;SLANG_RT_DYNAMIC_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
240231
<Optimization>Full</Optimization>
241232
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -249,14 +240,12 @@
249240
<EnableCOMDATFolding>true</EnableCOMDATFolding>
250241
<OptimizeReferences>true</OptimizeReferences>
251242
<ImportLibrary>..\..\..\bin\windows-x64\release\slang-rt.lib</ImportLibrary>
252-
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
253243
</Link>
254244
</ItemDefinitionGroup>
255245
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'">
256246
<ClCompile>
257247
<PrecompiledHeader>NotUsing</PrecompiledHeader>
258248
<WarningLevel>Level4</WarningLevel>
259-
<TreatWarningAsError>true</TreatWarningAsError>
260249
<PreprocessorDefinitions>NDEBUG;SLANG_RT_DYNAMIC;SLANG_RT_DYNAMIC_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
261250
<Optimization>Full</Optimization>
262251
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -270,7 +259,6 @@
270259
<EnableCOMDATFolding>true</EnableCOMDATFolding>
271260
<OptimizeReferences>true</OptimizeReferences>
272261
<ImportLibrary>..\..\..\bin\windows-aarch64\release\slang-rt.lib</ImportLibrary>
273-
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
274262
</Link>
275263
</ItemDefinitionGroup>
276264
<ItemGroup>

0 commit comments

Comments
 (0)