Suppressing compiler warning on Debian 12/gcc 12.2.0
Suppressing compiler warning on Debian 12/gcc 12.2.0
От:
Bruce Momjian <bruce@momjian.us>
Дата:
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 <> src/Makefile.custom < https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you.
Re: Suppressing compiler warning on Debian 12/gcc 12.2.0
От:
Bruce Momjian <bruce@momjian.us>
Дата:
On Thu, Aug 31, 2023 at 03:25:09PM -0400, Bruce Momjian wrote:
> 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
This might be simpler for people to modify since it abstracts out the
version checking.
---------------------------------------------------------------------------
# gmake per-file options: https://stackoverflow.com/questions/6546162/how-to-add-different-rules-for-specific-files
for FILE in configure.in configure.ac
do if [ -e "$FILE" ]
then VERSION=$(sed -n 's/^AC_INIT(\[PostgreSQL\], \[\([0-9]\+\).*$/\1/p' "$FILE")
break
fi
done
[ -z "$VERSION" ] && echo 'Could not find Postgres version' 1>&2 && exit 1
if [ "$VERSION" -eq 11 ]
then cat >> src/Makefile.custom <> src/Makefile.custom < https://momjian.us
EDB https://enterprisedb.com
Only you can decide what is important to you.