Re: warning: dereferencing type-punned pointer
От | Peter Eisentraut |
---|---|
Тема | Re: warning: dereferencing type-punned pointer |
Дата | |
Msg-id | 1fe7031f-3a25-40c3-b244-530ea42fc133@eisentraut.org обсуждение исходный текст |
Ответ на | Re: warning: dereferencing type-punned pointer (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: warning: dereferencing type-punned pointer
|
Список | pgsql-hackers |
On 24.07.24 16:05, Tom Lane wrote: > I'm not very thrilled with these changes. It's not apparent why > your compiler is warning about these usages of IsA and not any other > ones, I think one difference is that normally IsA is called on a Node * (since you call IsA to decide what to cast it to), but in this case it's called on a pointer that is already of type ErrorSaveContext *. You wouldn't normally need to call IsA on that, but it comes with the SOFT_ERROR_OCCURRED macro. Another difference is that most nodes are dynamically allocated but in this case the ErrorSaveContext object (not a pointer to it) is part of another struct, and so I think some different aliasing rules might apply, but I'm not sure. I think here you could just bypass the SOFT_ERROR_OCCURRED macro: - if (SOFT_ERROR_OCCURRED(&jsestate->escontext)) + if (jsestate->escontext.error_occurred)
В списке pgsql-hackers по дате отправления: