diff options
| author | Tom Lane | 2015-01-26 20:53:37 +0000 |
|---|---|---|
| committer | Tom Lane | 2015-01-26 20:53:37 +0000 |
| commit | 4b2a254793be50e31d43d4bfd813da8d141494b8 (patch) | |
| tree | d49b5455e63c118261740d5be9c2f7f3ce738ad2 /src/include/utils | |
| parent | dabda6415287bb8991c569036c1f5b57be62a58f (diff) | |
Add a note to PG_TRY's documentation about volatile safety.
We had better memorialize what the actual requirements are for this.
Diffstat (limited to 'src/include/utils')
| -rw-r--r-- | src/include/utils/elog.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h index fe5dec03a7a..b5cfc9cbc88 100644 --- a/src/include/utils/elog.h +++ b/src/include/utils/elog.h @@ -332,6 +332,13 @@ extern PGDLLIMPORT ErrorContextCallback *error_context_stack; * not without taking thought for what will happen during ereport(FATAL). * The PG_ENSURE_ERROR_CLEANUP macros provided by storage/ipc.h may be * helpful in such cases. + * + * Note: if a local variable of the function containing PG_TRY is modified + * in the PG_TRY section and used in the PG_CATCH section, that variable + * must be declared "volatile" for POSIX compliance. This is not mere + * pedantry; we have seen bugs from compilers improperly optimizing code + * away when such a variable was not marked. Beware that gcc's -Wclobbered + * warnings are just about entirely useless for catching such oversights. *---------- */ #define PG_TRY() \ |
