Обсуждение: Busted includes somewhere near worker_internal.h

Поиск
Список
Период
Сортировка

Busted includes somewhere near worker_internal.h

От
Tom Lane
Дата:
headerscheck and cpluspluscheck are both unhappy about this:

./src/include/replication/worker_internal.h:49:2: error: unknown type name 'slock_t'
  slock_t  relmutex;
  ^~~~~~~

Now, worker_internal.h itself hasn't changed in some time.
I conclude that somebody rearranged one of the header files
it depends on.  Anyone have an idea what the relevant change
was?  Should we just include spin.h here, or is there a
better fix?

            regards, tom lane



Re: Busted includes somewhere near worker_internal.h

От
Andres Freund
Дата:
Hi,

On 2020-07-17 16:09:14 -0400, Tom Lane wrote:
> headerscheck and cpluspluscheck are both unhappy about this:
> 
> ./src/include/replication/worker_internal.h:49:2: error: unknown type name 'slock_t'
>   slock_t  relmutex;
>   ^~~~~~~
> 
> Now, worker_internal.h itself hasn't changed in some time.
> I conclude that somebody rearranged one of the header files
> it depends on.  Anyone have an idea what the relevant change
> was?  Should we just include spin.h here, or is there a
> better fix?

I'm probably to blame for that - I've removed the s_lock.h (it wasn't
spin.h for some reason) include from lwlock.h:

commit f219167910ad33dfd8f1b0bba15323d71a91c4e9
Author: Andres Freund <andres@anarazel.de>
Date:   2020-06-18 19:40:09 -0700

    Clean up includes of s_lock.h.
    
    Users of spinlocks should use spin.h, not s_lock.h. And lwlock.h
    hasn't utilized spinlocks for quite a while.
    
    Discussion: https://postgr.es/m/20200618183041.upyrd25eosecyf3x@alap3.anarazel.de

I think including spin.h is the right fix, given that it needs to know
the size of s_lock.

Greetings,

Andres Freund



Re: Busted includes somewhere near worker_internal.h

От
Tom Lane
Дата:
Andres Freund <andres@anarazel.de> writes:
> On 2020-07-17 16:09:14 -0400, Tom Lane wrote:
>> headerscheck and cpluspluscheck are both unhappy about this:
>> ./src/include/replication/worker_internal.h:49:2: error: unknown type name 'slock_t'
>>     slock_t  relmutex;
>>     ^~~~~~~

> I think including spin.h is the right fix, given that it needs to know
> the size of s_lock.

Done that way.

            regards, tom lane