MSVC: lower C4100 warning level from 4 to 3 #104409

Closed
Germano Cavalcante wants to merge 1 commits from mano-wii:w34100 into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

With the C4100 warning, we better align with OSX/Linux warnings.


Although __pragma(warning(suppress:4100)) is not the same as __attribute__((__unused__)) in gcc (which only affects the attribute instead of the line), it still seems to be better to use it than to hide the warning entirely.

So, after lowering the warning level, adding this pragma to the existing UNUSED definitions suppressed most of the warnings.

In some projects, such as those in extern, this warning is suppressed via the cmake macros remove_strict_flags() and remove_extra_strict_flags(). So to handle those in MSVC too, it was enough to add remove_cc_flag(/w34100) to these macros.

Other cases the warning was specially suppressed for "GNUC" and "Clang" but missing for "MSVC". In these cases the corresponding MSVC pragma has been added.

Lastly, two projects had to be handled differently in MSVC because the warning appears in the windows libraries. These projects are Alembic and USD.

(Note that some C++ files used only for windows have been edited to silence the warning).

With the C4100 warning, we better align with OSX/Linux warnings. --- Although `__pragma(warning(suppress:4100))` is not the same as `__attribute__((__unused__))` in gcc (which only affects the attribute instead of the line), it still seems to be better to use it than to hide the warning entirely. So, after lowering the warning level, adding this `pragma` to the existing `UNUSED` definitions suppressed most of the warnings. In some projects, such as those in extern, this warning is suppressed via the cmake macros `remove_strict_flags()` and `remove_extra_strict_flags()`. So to handle those in MSVC too, it was enough to add `remove_cc_flag(/w34100)` to these macros. Other cases the warning was specially suppressed for "GNUC" and "Clang" but missing for "MSVC". In these cases the corresponding MSVC pragma has been added. Lastly, two projects had to be handled differently in MSVC because the warning appears in the windows libraries. These projects are `Alembic` and `USD`. (Note that some C++ files used only for windows have been edited to silence the warning).
Germano Cavalcante added this to the 3.5 milestone 2023-02-07 17:52:32 +01:00
Germano Cavalcante added the
Platform
Windows
label 2023-02-07 17:52:32 +01:00
Germano Cavalcante self-assigned this 2023-02-07 17:52:32 +01:00
Germano Cavalcante added 1 commit 2023-02-07 17:52:34 +01:00
94398c1304 MSVC: lower C4100 warning level from 4 to 3
This better aligns with OSX/Linux warnings.

---
Although `__pragma(warning(suppress:4100))` is not the same as `__attribute__((__unused__))` in gcc (which only affects the attribute instead of the line), it still seems to be better to use it than to hide the warning entirely.

So, after lowering the warning level, adding this `pragma` to the existing `UNUSED` definitions suppressed most of the warnings.

In some projects, such as those in extern, this warning is suppressed via the cmake macros `remove_strict_flags()` and `remove_extra_strict_flags()`. So to handle those in MSVC too, it was enough to add `remove_cc_flag(/w34100)` to these macros.

Other cases the warning was specially suppressed for "GNUC" and "Clang" but missing for "MSVC". In these cases the corresponding MSVC pragma has been added.

Lastly, two projects had to be handled differently in MSVC because the warning appears in the windows libraries. These projects are `Alembic` and `USD`.

(Note that some C++ files used only for windows have been edited to silence the warning).
Germano Cavalcante requested review from Ray molenkamp 2023-02-07 17:54:02 +01:00
Author
Member

The formal parameters that appear only for MSVC due to the USD and Alembic projects are:

bf_usd

formal parameter source include
dummy .\source\blender\io\usd\intern\usd_reader_mesh.cc .\lib\win64_vc15\usd\include\pxr\base\tf\weakPtrFacade.h
tp, tp .\source\blender\io\usd\intern\usd_capi_export.cc .\lib\win64_vc15\usd\include\pxr\base\vt\value.h
tp, tp .\source\blender\io\usd\intern\usd_writer_abstract.cc .\lib\win64_vc15\usd\include\pxr\base\vt\value.h
tp, tp .\source\blender\io\usd\intern\usd_writer_material.cc .\lib\win64_vc15\usd\include\pxr\base\vt\value.h
tp, tp .\source\blender\io\usd\intern\usd_writer_camera.cc .\lib\win64_vc15\usd\include\pxr\base\vt\value.h
tp, tp .\source\blender\io\usd\intern\usd_reader_camera.cc .\lib\win64_vc15\usd\include\pxr\base\vt\value.h
tp, tp .\source\blender\io\usd\intern\usd_writer_hair.cc .\lib\win64_vc15\usd\include\pxr\base\vt\value.h
tp, tp .\source\blender\io\usd\intern\usd_writer_mesh.cc .\lib\win64_vc15\usd\include\pxr\base\vt\value.h
tp, tp .\source\blender\io\usd\intern\usd_reader_material.cc .\lib\win64_vc15\usd\include\pxr\base\vt\value.h

bf_alembic

formal parameter source include
iFlag .\source\blender\io\alembic\intern\abc_reader_camera.cc .\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h
iFlag .\source\blender\io\alembic\intern\abc_reader_transform.cc .\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h
iFlag .\source\blender\io\alembic\intern\abc_reader_nurbs.cc .\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h
iFlag .\source\blender\io\alembic\intern\abc_reader_curves.cc .\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h
iFlag .\source\blender\io\alembic\intern\abc_reader_object.cc .\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h
iFlag .\source\blender\io\alembic\intern\abc_reader_points.cc .\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h
iFlag .\source\blender\io\alembic\intern\abc_reader_mesh.cc .\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h

The graph of includes for these projects is quite complex.
The includes are inside others that are inside others that always end in:

  • ...\lib\win64_vc15\usd\include\pxr\base\tf\weakPtrFacade.h
  • ...\lib\win64_vc15\usd\include\pxr\base\vt\value.h
  • ...\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h
The formal parameters that appear only for MSVC due to the `USD` and `Alembic` projects are: ## bf_usd | formal parameter | source | include | | -------- | -------- | -------- | | `dummy` | `.\source\blender\io\usd\intern\usd_reader_mesh.cc` | `.\lib\win64_vc15\usd\include\pxr\base\tf\weakPtrFacade.h` | | `tp`, `tp` | `.\source\blender\io\usd\intern\usd_capi_export.cc` | `.\lib\win64_vc15\usd\include\pxr\base\vt\value.h` | | `tp`, `tp` | `.\source\blender\io\usd\intern\usd_writer_abstract.cc` | `.\lib\win64_vc15\usd\include\pxr\base\vt\value.h` | | `tp`, `tp` | `.\source\blender\io\usd\intern\usd_writer_material.cc` | `.\lib\win64_vc15\usd\include\pxr\base\vt\value.h` | | `tp`, `tp` | `.\source\blender\io\usd\intern\usd_writer_camera.cc` | `.\lib\win64_vc15\usd\include\pxr\base\vt\value.h` | | `tp`, `tp` | `.\source\blender\io\usd\intern\usd_reader_camera.cc` | `.\lib\win64_vc15\usd\include\pxr\base\vt\value.h` | | `tp`, `tp` | `.\source\blender\io\usd\intern\usd_writer_hair.cc` | `.\lib\win64_vc15\usd\include\pxr\base\vt\value.h` | | `tp`, `tp` | `.\source\blender\io\usd\intern\usd_writer_mesh.cc` | `.\lib\win64_vc15\usd\include\pxr\base\vt\value.h` | | `tp`, `tp` | `.\source\blender\io\usd\intern\usd_reader_material.cc` | `.\lib\win64_vc15\usd\include\pxr\base\vt\value.h` | ## bf_alembic | formal parameter | source | include | | -------- | -------- | -------- | | `iFlag` | `.\source\blender\io\alembic\intern\abc_reader_camera.cc` | `.\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h` | | `iFlag` | `.\source\blender\io\alembic\intern\abc_reader_transform.cc` | `.\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h` | | `iFlag` | `.\source\blender\io\alembic\intern\abc_reader_nurbs.cc` | `.\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h` | | `iFlag` | `.\source\blender\io\alembic\intern\abc_reader_curves.cc` | `.\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h` | | `iFlag` | `.\source\blender\io\alembic\intern\abc_reader_object.cc` | `.\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h` | | `iFlag` | `.\source\blender\io\alembic\intern\abc_reader_points.cc` | `.\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h` | | `iFlag` | `.\source\blender\io\alembic\intern\abc_reader_mesh.cc` | `.\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h` | The graph of includes for these projects is quite complex. The includes are inside others that are inside others that always end in: - `...\lib\win64_vc15\usd\include\pxr\base\tf\weakPtrFacade.h` - `...\lib\win64_vc15\usd\include\pxr\base\vt\value.h` - `...\lib\win64_vc15\alembic\include\Alembic\Abc\ISchemaObject.h`
Member

I fixed the warns coming out of the lib folder in 4cc94679dd if you merge main, you should be able to get rid of the changes needed for alembic and USD

I fixed the warns coming out of the lib folder in 4cc94679ddb0d538493ead9e360ca38da0d58b3c if you merge main, you should be able to get rid of the changes needed for alembic and USD

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#104409
No description provided.