View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0023935 | Open CASCADE | OCCT:Application Framework | public | 2013-04-25 13:37 | 2015-07-27 15:01 |
Reporter | Assigned To | vro | |||
Priority | normal | Severity | minor | ||
Status | closed | Resolution | fixed | ||
Platform | Windows | OS | VC++ 2008 | ||
Product Version | 6.6.0 | ||||
Target Version | 6.7.0 | Fixed in Version | 6.7.0 | ||
Summary | 0023935: Compiler warnings on returning Handle from C functions in OCAF schemas | ||||
Description | The 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 | ||||
Tags | No tags attached. | ||||
Test case number | Not needed | ||||
|
Sergey, Could you process the issue. szy |
|
Vlad, process it, please. |
|
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. |
|
The change is in CR23935. The file Storage_Macros.hxx is modified. |
|
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. |
|
extern "C" is removed - warning disappeared. |
|
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 |
|
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; |
|
Dear Sergey, Could you review this fix. |
|
Reviewed. It seems Ok. |
|
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. |
|
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). |
|
Branch CR23935 has been deleted by kgv. SHA-1: f693ddf727beb624fabea425d76c5290860aa252 |
occt: master f8fc2b2a 2013-05-31 13:29:27 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 |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-04-25 13:37 |
|
New Issue | |
2013-04-25 13:37 |
|
Assigned To | => szy |
2013-04-25 18:17 |
|
Note Added: 0024281 | |
2013-04-25 18:17 |
|
Assigned To | szy => srn |
2013-04-25 18:17 |
|
Status | new => assigned |
2013-04-30 16:45 |
|
Note Added: 0024303 | |
2013-04-30 16:45 |
|
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 |
|
Note Added: 0024328 | |
2013-05-08 11:26 |
|
Assigned To | abv => vro |
2013-05-08 11:26 |
|
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 |
|
Assigned To | mkv => mpv |
2013-05-23 10:08 |
|
Status | resolved => assigned |
2013-05-24 17:04 |
|
Note Added: 0024511 | |
2013-05-24 17:04 |
|
Status | assigned => resolved |
2013-05-24 17:05 |
|
Assigned To | mpv => szy |
2013-05-24 17:06 |
|
Note Added: 0024512 | |
2013-05-29 17:21 |
|
Note Added: 0024548 | |
2013-05-29 17:21 |
|
Status | resolved => reviewed |
2013-05-31 17:25 |
|
Note Added: 0024588 | |
2013-05-31 17:26 |
|
Test case number | => Not needed |
2013-05-31 17:26 |
|
Assigned To | szy => bugmaster |
2013-05-31 17:26 |
|
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 |