View Issue Details

IDProjectCategoryView StatusLast Update
0023935Open CASCADEOCCT:Application Frameworkpublic2015-07-27 15:01
Reporterabv Assigned Tovro  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
PlatformWindowsOSVC++ 2008 
Product Version6.6.0 
Target Version6.7.0Fixed in Version6.7.0 
Summary0023935: Compiler warnings on returning Handle from C functions in OCAF schemas
DescriptionThe following warnings are reported by MS VC++ 9.0 compiler:

Warning 11 warning C4190: 'CreateShapeSchema' has C-linkage specified, but returns UDT 'Handle_Storage_Schema' which is incompatible with C D:\OCCT660\ros\drv\ShapeSchema\ShapeSchema.cxx 697 TKShapeSchema
Warning 12 warning C4190: 'CreateStdLSchema' has C-linkage specified, but returns UDT 'Handle_Storage_Schema' which is incompatible with C D:\OCCT660\ros\drv\StdLSchema\StdLSchema.cxx 221 TKStdLSchema
Warning 13 warning C4190: 'CreateStdSchema' has C-linkage specified, but returns UDT 'Handle_Storage_Schema' which is incompatible with C D:\OCCT660\ros\drv\StdSchema\StdSchema.cxx 133 TKStdSchema
Warning 15 warning C4190: 'CreateXCAFSchema' has C-linkage specified, but returns UDT 'Handle_Storage_Schema' which is incompatible with C D:\OCCT660\ros\drv\XCAFSchema\XCAFSchema.cxx 117 TKXCAFSchema

It seems the relevant functions are never and nowhere used, perhaps they could be safely removed
TagsNo tags attached.
Test case numberNot needed

Activities

szy

2013-04-25 18:17

manager   ~0024281

Sergey,
Could you process the issue.
szy

szy

2013-04-30 16:45

manager   ~0024303

Vlad,
process it, please.

vro

2013-05-08 11:06

developer   ~0024325

I just disabled the warning... It prevents calling of C++ objects from C code. But here we have a specific case: the returning C++ object is used only in C++.
Please, review the change. Any remarks are welcome.

vro

2013-05-08 11:07

developer   ~0024326

The change is in CR23935. The file Storage_Macros.hxx is modified.

abv

2013-05-08 11:26

manager   ~0024328

Instead of disabling a warning (which does not solve the problem and will not work on platforms other than Windows / MSVC), please consider either removing the offending method (if it is not used) or returning C pointer instead of Handle.

vro

2013-05-08 12:05

developer   ~0024330

extern "C" is removed - warning disappeared.

vro

2013-05-13 08:43

developer   ~0024365

Dear Mkv,
Could you please check compilation warnings on a Linux platform + run the non-regression tests on Ocaf Open and Save document operations? Any questions are welcome!
Vro

mpv

2013-05-24 17:04

developer   ~0024511

Removed "Create##schema" method at all: without "extern "C"" it is useless. Checked that in OCCT and Samples this method is unused.

"new ##Schema" is used instead (like in StdDrivers.cxx, for an example). Also this approach is advised in Storage_Schema.cdl:
        -- For example, if ShapeSchema is the class
        -- inheriting from Storage_Schema and containing
        -- the description of your application data schema,
        -- you create a storage/retrieval algorithm as follows:
        -- Handle(ShapeSchema) s = new
        -- ShapeSchema;

mpv

2013-05-24 17:06

developer   ~0024512

Dear Sergey,

Could you review this fix.

szy

2013-05-29 17:21

manager   ~0024548

Reviewed. It seems Ok.

mkv

2013-05-31 17:25

tester   ~0024588

Dear BugMaster,

Branch CR23935 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: f693ddf727beb624fabea425d76c5290860aa252

Number of compiler warnings:

occt component :
Linux: 2 (2 on master)
Windows: 7 (11 on master)

products component :
Linux: 0 (0 on master)
Windows: 64 (64 on master)

Regressions:
No regressions

Improvements:
No improvements

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 366261944 / 365724124
Total CPU difference: 45179.41000000107 / 44946.16000000121

Testing on Windows:
Total MEMORY difference: 419370844 / 416746180
Total CPU difference: 32812.75 / 35679.65625

There are not differences in images found by testdiff.

git

2014-12-30 09:05

administrator   ~0035862

Branch CR23935 has been created by mpv.

SHA-1: f693ddf727beb624fabea425d76c5290860aa252


Detailed log of new commits:

Author: mpv
Date: Fri May 24 16:54:45 2013 +0400

    Removed "Create##schema" method at all: without "extern "C"" it is useless. Checked that in OCCT and Samples this method is unused.
    
    "new ##Schema" is used instead (like in StdDrivers.cxx, for an example). Also this approach is advised in Storage_Schema.cdl:
            -- For example, if ShapeSchema is the class
            -- inheriting from Storage_Schema and containing
            -- the description of your application data schema,
            -- you create a storage/retrieval algorithm as follows:
            -- Handle(ShapeSchema) s = new
            -- ShapeSchema;

Author: vro
Date: Wed May 8 12:04:35 2013 +0400

    Second attempt to remove the warning: extern "C" is removed - everything works fine. But I tested it only on Windows.

Author: vro
Date: Wed May 8 11:05:02 2013 +0400

    The warning 4190 is disabled because a C++ object calling from C section is manipulating only in C++ (outside of C section).

git

2015-07-27 15:01

administrator   ~0043582

Branch CR23935 has been deleted by kgv.

SHA-1: f693ddf727beb624fabea425d76c5290860aa252

Related Changesets

occt: master f8fc2b2a

2013-05-31 13:29:27

vro

Details Diff
0023935: Compiler warnings on returning Handle from C functions in OCAF schemas

The warning 4190 is disabled because a C++ object calling from C section is manipulating only in C++ (outside of C section).
Second attempt to remove the warning: extern "C" is removed - everything works fine. But I tested it only on Windows.
Removed "Create##schema" method at all: without "extern "C"" it is useless. Checked that in OCCT and Samples this method is unused.

"new ##Schema" is used instead (like in StdDrivers.cxx, for an example). Also this approach is advised in Storage_Schema.cdl:
-- For example, if ShapeSchema is the class
-- inheriting from Storage_Schema and containing
-- the description of your application data schema,
-- you create a storage/retrieval algorithm as follows:
-- Handle(ShapeSchema) s = new
-- ShapeSchema;
Affected Issues
0023935
mod - src/Storage/Storage_Macros.hxx Diff File

Issue History

Date Modified Username Field Change
2013-04-25 13:37 abv New Issue
2013-04-25 13:37 abv Assigned To => szy
2013-04-25 18:17 szy Note Added: 0024281
2013-04-25 18:17 szy Assigned To szy => srn
2013-04-25 18:17 szy Status new => assigned
2013-04-30 16:45 szy Note Added: 0024303
2013-04-30 16:45 szy Assigned To srn => vro
2013-05-08 11:06 vro Note Added: 0024325
2013-05-08 11:06 vro Assigned To vro => abv
2013-05-08 11:06 vro Status assigned => resolved
2013-05-08 11:07 vro Note Added: 0024326
2013-05-08 11:26 abv Note Added: 0024328
2013-05-08 11:26 abv Assigned To abv => vro
2013-05-08 11:26 abv Status resolved => assigned
2013-05-08 12:05 vro Note Added: 0024330
2013-05-08 12:05 vro Assigned To vro => abv
2013-05-08 12:05 vro Status assigned => resolved
2013-05-13 08:43 vro Note Added: 0024365
2013-05-13 08:43 vro Assigned To abv => mkv
2013-05-13 08:43 vro Status resolved => assigned
2013-05-21 12:00 vro Status assigned => resolved
2013-05-23 10:08 abv Assigned To mkv => mpv
2013-05-23 10:08 abv Status resolved => assigned
2013-05-24 17:04 mpv Note Added: 0024511
2013-05-24 17:04 mpv Status assigned => resolved
2013-05-24 17:05 mpv Assigned To mpv => szy
2013-05-24 17:06 mpv Note Added: 0024512
2013-05-29 17:21 szy Note Added: 0024548
2013-05-29 17:21 szy Status resolved => reviewed
2013-05-31 17:25 mkv Note Added: 0024588
2013-05-31 17:26 mkv Test case number => Not needed
2013-05-31 17:26 mkv Assigned To szy => bugmaster
2013-05-31 17:26 mkv Status reviewed => tested
2013-06-03 14:48 vro Changeset attached => occt master f8fc2b2a
2013-06-03 14:48 vro Assigned To bugmaster => vro
2013-06-03 14:48 vro Status tested => verified
2013-06-03 14:48 vro Resolution open => fixed
2013-12-19 13:53 bugmaster Status verified => closed
2013-12-19 13:55 bugmaster Fixed in Version => 6.7.0
2014-12-30 09:05 git Note Added: 0035862
2015-07-27 15:01 git Note Added: 0043582