Re: Suspicion of a compiler bug in clang: using ternary operator in ereport()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Suspicion of a compiler bug in clang: using ternary operator in ereport()
Дата
Msg-id 31026.1391094088@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Suspicion of a compiler bug in clang: using ternary operator in ereport()  (Christian Kruse <christian@2ndquadrant.com>)
Ответы Re: Suspicion of a compiler bug in clang: using ternary operator in ereport()  (Christian Kruse <christian@2ndquadrant.com>)
Re: Suspicion of a compiler bug in clang: using ternary operator in ereport()  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
Christian Kruse <christian@2ndquadrant.com> writes:
> Have a look at the psprintf() call: we first have a _("failed to look
> up effective user id %ld: %s") as an argument, then we have a (long)
> user_id and after that we have a ternary expression using errno. Isn't
> it possible that the first _() changes errno?

While I haven't actually read the gettext docs, I'm pretty sure that
gettext() is defined to preserve errno.  It's supposed to be something
that you can drop into existing printf's without thinking, and if
it mangled errno that would certainly not be the case.

If this isn't true, we've got probably hundreds of places that would
need fixing, most of them of the form printf(_(...), strerror(errno)).
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: INTERVAL overflow detection is terribly broken
Следующее
От: Christian Kruse
Дата:
Сообщение: Re: Suspicion of a compiler bug in clang: using ternary operator in ereport()