I attached another cleanup patch which fixes following warnings reported
by Sun Studio:
"zic.c", line 1534: warning: const object should have initializer: tzh0
"dynloader.c", line 7: warning: empty translation unit
"pgstat.c", line 666: warning: const object should have initializer: all_zeroes
"pgstat.c", line 799: warning: const object should have initializer: all_zeroes
"pgstat.c", line 2552: warning: const object should have initializer: all_zeroes
"preproc.c", line 39569: warning: pointer expression or its operand do not
point to the same object yyerror_range, result is undefined and non-portable
"tab-complete.c", line 587: warning: assignment type mismatch:
pointer to function(pointer to const char, int, int) returning pointer
to pointer to char "=" pointer to void
Following list is still unfixed plus see my comments:
"gram.c", line 28487: warning: pointer expression or its operand do not point
to the same object yyerror_range, result is undefined and non-portable
- This is really strange warning. The code is really strange
because it points to -1 index of array, but I'm not bison guru.
Maybe it is correct, but it would be good if somebody check it.
"../../../src/include/pg_config.h", line 782: warning: macro redefined:
_FILE_OFFSET_BITS
- This probably needs some extra love in configure.
"regc_lex.c", line 401: warning: loop not entered at top
"regc_lex.c", line 484: warning: loop not entered at top
"regc_lex.c", line 578: warning: loop not entered at top
"regc_lex.c", line 610: warning: loop not entered at top
"regc_lex.c", line 870: warning: loop not entered at top
"regc_lex.c", line 1073: warning: loop not entered at top
"postgres.c", line 3845: warning: loop not entered at top
- Assert on not reached place probably confuse compiler. I'm not
sure if it make sense nowadays? Most compiler should optimize
this anyway and code is removed. I suppose to remove these
asserts.
Zdenek
diff -Nrc pgsql.orig.8fc4f032818a/src/backend/port/dynloader/solaris.c pgsql.orig/src/backend/port/dynloader/solaris.c
*** pgsql.orig.8fc4f032818a/src/backend/port/dynloader/solaris.c 2009-05-28 11:09:24.874020865 +0200
--- pgsql.orig/src/backend/port/dynloader/solaris.c 2009-05-28 11:09:24.893688008 +0200
***************
*** 5,7 ****
--- 5,11 ----
*
* see solaris.h
*/
+
+ /* compiler complains about empty unit, let compiler quite */
+ extern int no_such_variable;
+
diff -Nrc pgsql.orig.8fc4f032818a/src/backend/postmaster/pgstat.c pgsql.orig/src/backend/postmaster/pgstat.c
*** pgsql.orig.8fc4f032818a/src/backend/postmaster/pgstat.c 2009-05-28 11:09:24.882883806 +0200
--- pgsql.orig/src/backend/postmaster/pgstat.c 2009-05-28 11:09:24.894106321 +0200
***************
*** 662,669 ****
void
pgstat_report_stat(bool force)
{
! /* we assume this inits to all zeroes: */
! static const PgStat_TableCounts all_zeroes;
static TimestampTz last_report = 0;
TimestampTz now;
--- 662,668 ----
void
pgstat_report_stat(bool force)
{
! static const PgStat_TableCounts all_zeroes = {0,0,0,0,0,0,0,0,0,0,0};
static TimestampTz last_report = 0;
TimestampTz now;
***************
*** 795,802 ****
static void
pgstat_send_funcstats(void)
{
! /* we assume this inits to all zeroes: */
! static const PgStat_FunctionCounts all_zeroes;
PgStat_MsgFuncstat msg;
PgStat_BackendFunctionEntry *entry;
--- 794,800 ----
static void
pgstat_send_funcstats(void)
{
! static const PgStat_FunctionCounts all_zeroes = {0,{0,0},{0,0}};
PgStat_MsgFuncstat msg;
PgStat_BackendFunctionEntry *entry;
***************
*** 2548,2555 ****
void
pgstat_send_bgwriter(void)
{
! /* We assume this initializes to zeroes */
! static const PgStat_MsgBgWriter all_zeroes;
/*
* This function can be called even if nothing at all has happened. In
--- 2546,2552 ----
void
pgstat_send_bgwriter(void)
{
! static const PgStat_MsgBgWriter all_zeroes = { {0,0},0,0,0,0,0,0,0};
/*
* This function can be called even if nothing at all has happened. In
diff -Nrc pgsql.orig.8fc4f032818a/src/bin/psql/tab-complete.c pgsql.orig/src/bin/psql/tab-complete.c
*** pgsql.orig.8fc4f032818a/src/bin/psql/tab-complete.c 2009-05-28 11:09:24.890322342 +0200
--- pgsql.orig/src/bin/psql/tab-complete.c 2009-05-28 11:09:24.894581639 +0200
***************
*** 557,563 ****
/* Forward declaration of functions */
! static char **psql_completion(char *text, int start, int end);
static char *create_command_generator(const char *text, int state);
static char *drop_command_generator(const char *text, int state);
static char *complete_from_query(const char *text, int state);
--- 557,563 ----
/* Forward declaration of functions */
! static char **psql_completion(const char *text, int start, int end);
static char *create_command_generator(const char *text, int state);
static char *drop_command_generator(const char *text, int state);
static char *complete_from_query(const char *text, int state);
***************
*** 584,590 ****
initialize_readline(void)
{
rl_readline_name = (char *) pset.progname;
! rl_attempted_completion_function = (void *) psql_completion;
rl_basic_word_break_characters = "\...@$><=;|&{( ";
--- 584,590 ----
initialize_readline(void)
{
rl_readline_name = (char *) pset.progname;
! rl_attempted_completion_function = psql_completion;
rl_basic_word_break_characters = "\...@$><=;|&{( ";
***************
*** 603,609 ****
libraries completion_matches() function, so we don't have to worry about it.
*/
static char **
! psql_completion(char *text, int start, int end)
{
/* This is the variable we'll return. */
char **matches = NULL;
--- 603,609 ----
libraries completion_matches() function, so we don't have to worry about it.
*/
static char **
! psql_completion(const char *text, int start, int end)
{
/* This is the variable we'll return. */
char **matches = NULL;
diff -Nrc pgsql.orig.8fc4f032818a/src/timezone/zic.c pgsql.orig/src/timezone/zic.c
*** pgsql.orig.8fc4f032818a/src/timezone/zic.c 2009-05-28 11:09:24.893104510 +0200
--- pgsql.orig/src/timezone/zic.c 2009-05-28 11:09:24.894905527 +0200
***************
*** 1531,1537 ****
int timecnt32, timei32;
int pass;
static char *fullname;
! static const struct tzhead tzh0;
static struct tzhead tzh;
zic_t ats[TZ_MAX_TIMES];
unsigned char types[TZ_MAX_TIMES];
--- 1531,1537 ----
int timecnt32, timei32;
int pass;
static char *fullname;
! static const struct tzhead tzh0 = {0,0,0,0,0,0,0,0,0};
static struct tzhead tzh;
zic_t ats[TZ_MAX_TIMES];
unsigned char types[TZ_MAX_TIMES];
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers