Re: [HACKERS] --enable-debug
От | Tom Lane |
---|---|
Тема | Re: [HACKERS] --enable-debug |
Дата | |
Msg-id | 16267.948866500@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: [HACKERS] --enable-debug (Bruce Momjian <pgman@candle.pha.pa.us>) |
Ответы |
Re: [HACKERS] --enable-debug
|
Список | pgsql-hackers |
Bruce Momjian <pgman@candle.pha.pa.us> writes: >> Currently, I believe -Wall is turned on automatically if your compiler >> is gcc --- at least it seems to work that way on my platform (maybe >> it's in the hpux_gcc template?). Anyway I get a pretty good set of -W >> options without doing anything special. > I remember when we removed every warning gcc -Wall complained about. Um, did we stop? In my experience, gcc is an excellent detector of portability problems. I believe that it is good practice to crank gcc's warning level out to the max, and to fix everything that it complains about. Some gcc warnings are not really portability problems. For example, it may gripe about "variable X may be used without being initialized" when a human can easily see from the code logic that X will not actually get read in any execution path that it wasn't previously set in. Still, I'm willing to shut gcc up by adding a redundant initialization of X, rather than turning down its warning level or making a habit of ignoring what it says. If you go down one of those other paths you are likely to miss warnings that could have saved you from genuine bugs. In short: I like to see Postgres compile with no warnings at all even with a very anal-retentive set of gcc settings. Just to give you an idea of what I consider anal-retentive ;-), here is what I customarily compile the IJG JPEG sources with: CFLAGS= -g -O2 -ansi -Wall -Wtraditional -Wshadow -Wwrite-strings \-Wpointer-arith -Wbad-function-cast -Wcast-qual -Wid-clash-15\-Wstrict-prototypes -Wmissing-prototypes # -Wconversion would be nice, but it complains about some stdio macros on HPUX Before any release I also eliminate any warnings shown by several other Unix and PC compilers cranked out to their max warning levels. I believe that this practice has helped to make libjpeg one of the most portable libraries on the planet. Compiler warnings can be your friend. Use 'em. regards, tom lane organizer, Independent JPEG Group
В списке pgsql-hackers по дате отправления: