FLTK logo

Re: [fltk.coredev] RFC: Disable Visual Studio warning about

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: RFC: Disable Visual Studio warning about Albrecht Schlosser Feb 23, 2021  
 
On 2/22/21 12:55 PM Albrecht Schlosser wrote:
On 2/22/21 12:22 PM imm wrote:
On Mon, 22 Feb 2021, 10:59 Manolo wrote:

In the case of nanosvg ... 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]).

...

[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?

After a little research it's clear that the scope of #pragma is the compilation unit regardless of #include files (include files are parsed by the preprocessor and are not known to the compiler). This means that it's bad style to set a #pragma inside a header file (nanosvg) w/o restoring its value at the end of the header file (which includes the implementation in this case).

That said, I tried a "clean" solution with a /minimal/ patch that just adds the (hopefully) correct #pragma statements for VS and leaves the rest as-is. See attached 'nanosvg-warnings.diff'.

Meanwhile I'm more for option (1) than (2) because it doesn't change much of the existing code and provides a clean solution, i.e. (a) suppresses warnings only in nanosvg code and (b) restores the #pragma so it doesn't affect the FLTK code in src/Fl_SVG_Image.cxx.

This patch compiled in my tests w/o warnings in Fl_SVG_Image.cxx and/or nanosvg.h with VS 2019. The GitHub build log of my own fork with this patch can be found here:
https://github.com/Albrecht-S/fltk/runs/1965066789

So after all I think both options (1: extra implementation file) and (2: see patch) are fine and I'm undecided.

Votes, anybody?

--
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/5a9716f1-3403-0278-4d38-35dfbc7ae007%40online.de.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.