Re: pgsql: Move gramparse.h to src/backend/parser

From: "Anton A(dot) Melnikov" <a(dot)melnikov(at)postgrespro(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, John Naylor <johncnaylorls(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Move gramparse.h to src/backend/parser
Date: 2026-03-30 01:30:56
Message-ID: fb969d8d-7ef5-471b-ae90-d20cdbf6660b@postgrespro.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Hi!

Sorry for the very long delay in responding, and thank you for your patience.
Regarding to previous points:

On 16.10.2025 07:19, John Naylor wrote:
>
> Also, that fix
> was in response to a specific change in dependencies, so I don't see
> how it's directly applicable to earlier branches. Maybe there is
> something to be done here, but with such a sporadic failure, I'm not
> sure what.

On 16.10.2025 07:34, Tom Lane wrote:
> Yeah. One build failure in three years does not sound to me like
> something to panic about. It sounds more like a local problem.
> Also, I note that alligator is self-described as running a
> "gcc experimental (nightly build)" compiler, so temporary build
> glitches on it are hardly unexpected.

this all seems quite reasonable but i observe the same behavior
on earlier branches as well.
Using a pre-built source tree at REL_14/15_STABLE,
this reproduction:

cd src/backend/parser
rm -rf .deps/ gram.c scan.c *.o *.bc gram.h
make parser.bc

results in:

$ make parser.bc
/usr/lib/llvm-16/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang
-no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-deprecated-non-prototype
-O2 -I. -I. -I../../../src/include -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/local/include -flto=thin -emit-llvm
-c -o parser.bc parser.c
In file included from parser.c:25:
../../../src/include/parser/gramparse.h:29:10: fatal error: 'parser/gram.h' file not found
#include "parser/gram.h"
^~~~~~~~~~~~~~~
1 error generated.
make: *** [../../../src/Makefile.global:1084: parser.bc] Error 1

Also as a possible improvement perhaps make the fix less strictly?
I.e. replace each .bc file's dependency on all .o files
with a more weak dependency just on all .c files.
Namely use
$(patsubst %.o,%.bc, $(OBJS)): $(patsubst %.o,%.c, $(OBJS))
instead of:
$(patsubst %.o,%.bc, $(OBJS)): $(OBJS)

This should still ensure correct build ordering, and it
will run faster during parallel builds, since it won't wait
for absolutely all the object files to be created.

For example, rebuilding parser.bc would then require only
a single compiler call in src/backend/parser.
See the attached bc-depends-on-c.txt for details.

Best regards,

--
Anton A. Melnikov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
bc-depends-on-c.txt.txt text/plain 1.0 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Langote 2026-03-30 01:32:34 pgsql: Doc: fix stale text about partition locking with cached plans
Previous Message Amit Langote 2026-03-30 01:13:03 pgsql: Add comment explaining fire_triggers=false in ri_PerformCheck()