Re: Suppressing compiler warning on Debian 12/gcc 12.2.0

2023-09-04 Thread Bruce Momjian
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" ]
thenVERSION=$(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 ]
thencat >> src/Makefile.custom <> src/Makefile.custom 

Suppressing compiler warning on Debian 12/gcc 12.2.0

2023-08-31 Thread Bruce Momjian
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
thencat >> src/Makefile.custom > src/Makefile.custom