|
|
On 2/22/21 12:22 PM imm wrote:
On Mon, 22 Feb 2021, 10:59 Manolo wrote:
What about adding in our own nanosvg branch an extra "pragma
warning" to the 2 already present in nanosvg.h and obtain
#ifdef _MSC_VER
#pragma warning (disable: 4996) // Switch off security warnings
#pragma warning (disable: 4100) // Switch off unreferenced
formal parameter warnings
#pragma warning (disable: 4244) // Switch off implicit type
conversion warnings <---- this would be added
Alternatively, would adding explicit casts work to silence the warning?
Yes this would work but ...
I think an explicit cast (if it works!) would be "better" than turning
off the warning with the pragma. Maybe...
... (IMO) we don't want to change much of the code of bundled libs
unless /necessary/, otherwise updating the libs becomes more difficult.
We have our FLTK specific scaling and one MSVC specific patch and Greg
worked on another patch recently.
For the same reason I added compiler options to suppress such warnings
in the bundled jpeg and zlib code (png didn't exhibit such warnings).
In the case of nanosvg we can't do the same because it's included in our
code (unless we use option (2) below). I think we have these options:
(1) Enable the warning (pragma) in Fl_SVG_Image.cxx just before we
include the nanosvg headers and (maybe [1]) disable it afterwards.
(2) Use a new file just for the nanosvg implementation (maybe
fl_nanosvg.cxx?) and use the #pragma before the inclusion of nanosvg
headers (no restore needed [1]).
(3) Would be to change the nanosvg files in our branch as proposed by
Manolo.
(4) Would be to leave the warnings as-is.
Option (2) would result in a very short file but provide a clean
separation, not only for the "new" pragma but also for the existing ones.
I'd opt for (2), (1), (3), (4) in this order of precedence (highest first).
--------
[1] Regarding #pragma (scope):
Does anybody know what scope such #pragma's have? Would they only be
valid inside the (included) file or would they extend to our FLTK code
*after* the inclusion of the nanosvg headers? Anyway, it looks like we
could do something like this:
#ifdef __MSC_VER
#pragma warning (push)
#pragma warning (disable: 4244)
#endif
{ include nanosvg stuff here }
#ifdef _MSC_VER
#pragma warning (pop)
#endif
The "easier" option w/o #pragma push/pop would probably be a separate
file for nanosvg implementation.
--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/6f29322e-88da-6bd0-9c7b-7ac666bebf14%40online.de.
[ Direct Link to Message ] | |
|
| |