Am Sonntag, 4. November 2018 14:50:00 CET schrieb Jean-Marc Lasgouttes <lasgout...@lyx.org>: > Le 28/10/2018 à 09:39, Scott Kostyshak a écrit : > > Dear all, > > > > I think that preserving compilation with -Werror can help catch real > > bugs. Most of the time, warnings are harmless/incorrect, and can even be > > a pain to address. It's thus debatable whether the bother of fixing > > harmless/incorrect warnings is worth the small chance of catching a real > > bug. > > Having a 0 warning build is of course a valuable goal, and we have done > that for years. There are however warnings that we cannot really > prevent, like the ones in code we do not control (I get some from > qt-generated code, for example). > > > I would like to add a policy to our Development.lyx manual. The policies > > we have in there are not hard policies and exceptions can always be > > made. It would just be nice to have a basis for discussion. > > I am not against policies, unless we have to make unreasonable changes > to code to meet them. > > > There is a recent issue that Kornel and I have been dealing with, where > > the -Werror in GCC 7.3.0 is more strict than in GCC 5.4.0. I think this > > is common, as compilers try to add detection of more potential problems. > > However, it creates an extra burden on the developer because they need > > to address a warning that does not show up for their GCC version. > > In this particular case, I do not think a convenience function for > Kornel's debugging needs deserves code like > > #pragma GCC diagnostic push > #pragma GCC diagnostic ignored "-Wpragmas" > #pragma GCC diagnostic ignored "-Wunused" > #pragma GCC diagnostic ignored "-Wunused-function" > > #ifdef __GNUC__ > #define SUPPRESS_NOT_USED_WARN __attribute__ ((unused)) > #else > #define SUPPRESS_NOT_USED_WARN > #endif > > void SUPPRESS_NOT_USED_WARN setIgnoreFormat(string type, bool value) > { > IgnoreFormats().setIgnoreFormat(type, value); > } > #pragma GCC diagnostic pop > > Kornel, what if setIgnoreFormat() was renamed to set()? Then calling > IgnoreFormats::set() is not really worse than your setIgnoreFormat() helper?
It is not meant as a convenient debugging function. I was hoping to use this function from a dialog where one would set ignoring options. > I know I am getting away from the big principles, but I think that > avoiding warnings can often be done by pragmatic solutions. > > Another possibility: > #define setIgnoreFormat(type, bool) IgnoreFormats::setIgnoreFormat(type, > value) > > BTW I have questions on this code: > - IgnoreFormat is not a class, since it does not hold data. Basically, > this is a namespace with global data in it. In this respect, I do not > understand what IgnoreFormat() means. See below > - This means that the "IgnoreFormats f" member hold by the LaTeXInfo > class does not make sense. > > What I would propose is to remove the "static" specifiers in the class > definition. Then one would need to instantiate a IgnoreFormats instance > everytime we need one. Please no. We need exactly the same data for all subsequent matches. I prefer to not recreate them each time. And if we recreate it, we need another set of static vars for initialization ... this makes no sense for me. > JMarc Kornel
signature.asc
Description: This is a digitally signed message part.