public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bruce Momjian <[email protected]>
To: PostgreSQL-development <[email protected]>
Subject: Suppressing compiler warning on Debian 12/gcc 12.2.0
Date: Thu, 31 Aug 2023 15:25:09 -0400
Message-ID: <[email protected]> (raw)

Being a new user of Debian 12/gcc 12.2.0, I wrote the following shell
script to conditionally add gmake rules with compiler flags to
src/Makefile.custom to suppress warnings for certain files.  This allows
me to compile all supported Postgres releases without warnings.

I actually didn't how simple it was to add per-file compile flags until
I read:

	https://stackoverflow.com/questions/6546162/how-to-add-different-rules-for-specific-files

---------------------------------------------------------------------------

# PG 14+ uses configure.ac
if [ ! -e configure.in ] || grep -q 'AC_INIT(\[PostgreSQL\], \[13\.' configure.in
then    cat >> src/Makefile.custom <<END
# work around gcc -O1 bug found in PG 13-current, not -O[023], 2023-08-28
# https://www.postgresql.org/message-id/[email protected]
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111240
# gmake fix:  https://stackoverflow.com/questions/6546162/how-to-add-different-rules-for-specific-files
clauses.o: CFLAGS+=-O2
END
fi

if [ -e configure.in ] && grep -q 'AC_INIT(\[PostgreSQL\], \[11\.' configure.in
then    cat >> src/Makefile.custom <<END
# new warning in Debian 12, gcc (Debian 12.2.0-14) 12.2.0, 2023-08-14
# Fix for valid macro using stack_base_ptr, warning only in PG 11
postgres.o: CFLAGS+=-Wdangling-pointer=0
END
fi

-- 
  Bruce Momjian  <[email protected]>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.






view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Suppressing compiler warning on Debian 12/gcc 12.2.0
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox