Visual Studio Compiler error in orbOptionsReg.cc [Patch]

Daniel Krügler via omniORB-list <[email protected]> Fri, 14 Oct 2022 18:23:44 +0200
Newsgroups gmane.comp.corba.omniorb.user
Message-ID <CAGNvRgD0ZN0eXweN8iViPRemMpDOYtofzhdT7i_GaED6trDdCQ@mail.gmail.com>
Hi,

We recently tried to build omniORB 4.3.0 using VS 2019 under C++20
language conditions (Full compiler conditions below) and got the
following compile error in orbOptionsReg.cc:

orbOptionsReg.cc
orbOptionsReg.cc(55): error C2440: '=': cannot convert from 'const
char [17]' to 'char *'
orbOptionsReg.cc(55): note: Conversion from string literal loses const
qualifier (see /Zc:strictStrings)
orbOptionsReg.cc(74): error C2440: '=': cannot convert from 'const
char [21]' to 'char *'
orbOptionsReg.cc(74): note: Conversion from string literal loses const
qualifier (see /Zc:strictStrings)
orbOptionsReg.cc(93): error C2440: '=': cannot convert from 'const
char [25]' to 'char *'
orbOptionsReg.cc(93): note: Conversion from string literal loses const
qualifier (see /Zc:strictStrings) cl -c -O2 -std:c++20 -Zc:__cplusplus
-D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS
-D_ENABLE_EXTENDED_ALIGNED_STORAGE -DSTRICT -DWIN32 -D_WINDOWS
-DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00 -DNOMINMAX -MP -EHs -GR -bigobj
-O2 -MD -Zi -DNDEBUG -D_ITERATOR_DEBUG_LEVEL=0 -I.. -I.\..
-I..\..\..\..\include\omniORB4\internal -DUSE_omniORB_logStream
-D_OMNIORB_LIBRARY -DOMNIORB_VERSION_STRING=\"4.3.0\"
-DOMNIORB_VERSION_HEX=0x040300f1
-DCONFIG_DEFAULT_LOCATION=\"C:\\OMNIORB.CFG\"
-DCONFIG_ENV=\"OMNIORB_CONFIG\" -DNTArchitecture -I. -I.
-I..\..\..\..\include -D__WIN32__ -D_WIN32_WINNT=0x0A00 -D__x86__
-D__NT__ -D__OSVERSION__=4 -D_CRT_SECURE_NO_DEPRECATE=1
-Foshared\orbOptionsReg.o -Fdshared\ -TporbOptionsReg.cc
make[3]: *** [../../../../mk/win32.mk:456: shared/orbOptionsReg.o] Error 2
[..]
[ERROR] Command execution failed.

Looking at the offending code location it is surprising that it had
compiled before, because this was never valid C++ since from the
beginning. To be fair: I guess this was only ever seen by Visual
Studio compilers before and it is a rather new development for them to
become more conforming (which is a great development). The fix was
rather simple, I attached a patch file, after its application we could
successfully build and run the rest.

Speaking of code contributions and patches: I recently found that a
stub github project exists for omniORB
(https://github.com/omniorb/omniorb). Can we expect a complete
migration to github in the near future? It would IMO make it much
easier for others like me to actively contribute to its development.

Thanks, Duncan and coworkers, for your great product that we are now
using for about two decades!

Regards,

- Daniel

_______________________________________________
omniORB-list mailing list
[email protected]
https://www.omniorb-support.com/mailman/listinfo/omniorb-list
omniorb-4.3.0.patch (text/plain, 233 B)
@@ -49,7 +49,7 @@ static void parseOldConfigReg(orbOptions& opt, HKEY rootkey);
 CORBA::Boolean
 orbOptions::importFromRegistry() {
 
-  char* rootregname;
+  const char* rootregname;
   HKEY  rootkey;
 
   rootregname = NEW_REGKEY;