Archived issue #0029310

Coding - multiple compiler warnings in Inspectors

Open CASCADEOCCT:Codingclosed20 public notes

Search issues

Description

When building Inspectors module (with CMake options BUILD_Inspectors and BUILD_USE_PCH set ON) with MSVC 2013, I observe hundreds of compiler warnings, mostly related to Qt:
- conditional expression is constant in QASSERT
- class 'Q...' needs to have dll-interface....
etc.

Steps to reproduce

Build OCCT with MSVC 2013 using CMake setting BUILD_USE_PCH and BUILD_Inspectors ON, with Qt 5.9.1

Public activity

20 archived notes

Participants are labeled by their role within this record.

01Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Thu Nov 9 17:51:26 2017 +0300

    0029310: Coding - multiple compiler warnings in Inspectors
    
    Inclusion of Qt headers is wrapped into #pragma statements on MSVC to shut down warnings.
    Code is corrected to avoid warning due to use of floating point values in integer calculations.
02Commenter 2
Branch [archived branch] has been updated by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Mon Nov 13 16:37:25 2017 +0300

    # fix for building on Linux

03Commenter 3
Corrections are pushed to branch CR29310 and tested to be compilable (see Jenkins job CR29310-master-abv), please review
04Commenter 2
Branch [archived branch] has been created by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Tue Jan 9 19:00:02 2018 +0300

    0029310: Coding - multiple compiler warnings in Inspectors
    
    1. Inclusion auxiliary file before Qt headers. It lets to avoid MSVC warnings(override definition on VS 2013 and warning 4127).
    2. Avoid using CMAKE_AUTOMOC due to warnings in CMake 3.10. This option leads to analyze qrc resource files for moc utility. Using only qt5/4_wrap_cpp metods.
05Commenter 2
Branch [archived branch] has been updated by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Wed Jan 10 11:06:18 2018 +0300

    0029310: Coding - multiple compiler warnings in Inspectors
    
    1. Inclusion auxiliary file before Qt headers. It lets to avoid MSVC warnings(override definition on VS 2013 and warning 4127).
    2. Avoid using CMAKE_AUTOMOC due to warnings in CMake 3.10. This option leads to analyze qrc resource files for moc utility. Using only qt5/4_wrap_cpp metods.
    3. Code is corrected to avoid warning due to use of floating point values in integer calculations.

06Commenter 2
Branch [archived branch] has been created by Commenter 3.

[revision removed]


No new revisions were added by this update.
07Commenter 2
Branch [archived branch] has been updated by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Wed Jan 10 14:55:06 2018 +0300

    0029310: Coding - multiple compiler warnings in Inspectors
    
    1. Inclusion auxiliary file before Qt headers. It lets to avoid MSVC warnings(override definition on VS 2013 and warning 4127).
    2. Avoid using CMAKE_AUTOMOC due to warnings in CMake 3.10. This option leads to analyze qrc resource files for moc utility. Using only qt5/4_wrap_cpp metods.
    3. Code is corrected to avoid warning due to use of floating point values in integer calculations.

08Commenter 3
1. one more warning has been found in described environment(qt 5.9.1):
- nonstandard extension used: override specifier 'override'
In Qt5x, the following Qt definition is active under MSVC 2010/2013:
#define Q_DECL_OVERRIDE override.

Where 'override' is C++11 features and may not be available in this version of studio.
So, to hide this warning we need to set Q_DECL_OVERRIDE to empty value until other Qt headers are included.
Implemented solution: new TInspectorAPI_Q_DECL_OVERRIDE.hxx that is called in all headers where Qt class is included.

2. 'conditional expression is constant in QASSERT' is covered by:
#pragma warning(disable : 4127), that is also moved to TInspectorAPI_Q_DECL_OVERRIDE.hxx

3. 'class 'Q...' needs to have dll-interface....' is covered by Qt in qglobal.h

For information:
- These warnings were reproduced even with BUILD_USE_PCH set OFF.
- Warnings have been checked on different versions of CMake 3.10.0-rc2 and CMake 3.6.2: reproduced.
09Commenter 3
Dear Andrey, please review modifications.

Jenkins build is the next: http://jenkins-test-10.nnov.opencascade.com:8080/view/CR29310_2-master-nds/

However, this build uses qt4, MSVC10.

[signature removed]Natalia
10Commenter 2
Branch [archived branch] has been created by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Sun Mar 4 19:10:56 2018 +0300

    0029310: Coding - multiple compiler warnings in Inspectors
    
    1. Added classes to hide and restore compilation warnings: Standard_WarningsDisable.hxx, Standard_WarningsRestore.hxx. It uses #pragma if MSVC compilation mode.
    2. Inspector: for all includes of Qt headers include disable warning before and restore warnings after.
    3. Inspector: minor code correction to avoid warning due to use of floating point values in integer calculations.
11Commenter 3
Dear Andrey, please review modifications.

Jenkins build is the next: http://jenkins-test-10.nnov.opencascade.com/view/CR29310_3-master-NDS
12Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
13Commenter 13
Reviewed with minor amendments (text of comments), please integrate
14Commenter 1
Combination -
OCCT branch : [archived branch] SHA - [revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian70-64:
OCCT
Total CPU difference: 18385.67999999971 / 18338.37999999957 [+0.26%]
Products
Total CPU difference: 7501.23000000001 / 7461.340000000009 [+0.53%]
Windows-64-VC10:
OCCT
Total CPU difference: 17656.333580898547 / 17653.338361698563 [+0.02%]
Products
Total CPU difference: 8011.946158299975 / 7990.761222500007 [+0.27%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
15Commenter 2
Branch [archived branch] has been updated by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Fri Mar 16 14:14:02 2018 +0300

    # remove not correct copyright

16Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
17Commenter 2
Branch [archived branch] has been deleted by Commenter 4.

[revision removed]
18Commenter 2
Branch [archived branch] has been deleted by Commenter 4.

[revision removed]
19Commenter 2
Branch [archived branch] has been deleted by Commenter 4.

[revision removed]
20Commenter 2
Branch [archived branch] has been deleted by Commenter 4.

[revision removed]

Related records