Suppressing compiler warning on Debian 12/gcc 12.2.0

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Suppressing compiler warning on Debian 12/gcc 12.2.0
Date: 2023-08-31 19:25:09
Message-ID: ZPDpFRfJe9TCY4AC@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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/ZOz3cBySkbEA5RN+@momjian.us
# 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 <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

Only you can decide what is important to you.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2023-08-31 19:30:15 Re: Document efficient self-joins / UPDATE LIMIT techniques.
Previous Message Andrey M. Borodin 2023-08-31 18:51:35 Re: UUID v7