From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Clifton To: koch@cognex.com Cc: egcs@cygnus.com Subject: Re: Should warnings be issued for unrecognised pragmas ? Date: Fri, 17 Oct 1997 15:06:00 -0000 Message-id: <199710172208.PAA29771@elmo.cygnus.com> References: <199710172114.RAA03799@beau_jos.cognex.com> X-SW-Source: 1997-10/msg00762.html > Date: Fri, 17 Oct 1997 17:14:00 -0400 > From: Donald Koch > > > > Date: Fri, 17 Oct 1997 14:59:46 -0400 > > > From: Donald Koch > > > > > > -Wall check for too many useful things, which is what it should do. > > > > Sorry, I do not understand that sentance. > [...] > > Nick > > Sorry, brain slipped out gear mid-sentence. -Wall should check for > the most useful warnings. Adding too many will make it unusable. > The question basically is: is -Wunrecognised-pragmas going to be used > much more often than not when -Wall is used? I don't want to have to > be adding too many -Wno-... flags. (Maybe we should add a -Wsome > or -Wmost flag? ;-) I guess it depends on what is meant by "all". And how much is too much. Personally I suspect that most programmers only use -Wall occaisionally to see how their source is fairing, because they are already overwhelmed by the number of warnings it produces, especially if they have inherited some code from somebody else. > (According to the documentation, this would be determined by whether > -Wunreconised-pragmas came before or after the description of > -Wall.) True. > I take it that we are targetting some specific pragmas. Which ones? True. The original work came up when we were asked to provide a port that would support code that had previously been compiled by the Green Hills toolsuite. That code used Green Hills specific pragmas in various places, and in the course of improving the code that handles this situation I noticed that GCC was not issuing any warnings when it did not recognise their pragmas. I am not sure if it is appropriate for me to describe specific pragmas, since this is really a generic problem, rather than one of compatibility with a particualr vendor's toolchain. To take a specific, invented example however, the "pack" pragma is a case in point. As it happens GCC does handle this pragma, but if it did not then it could cause all kinds of hard to find errors in the user's programs, when their structures do not match the sizes expected by the code. Not having a warning message to help idenitfy this situation would only makes finding the "bug" that much harder. Nick