Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit03c5a00

Browse files
committed
Move the extern declaration for ExceptionalCondition into c.h.
This is the logical conclusion of our decision to support Assert()in both frontend and backend code: it should be possible to use thatafter including just c.h. But as things were arranged before, ifyou wanted to use Assert() in code that might be compiled for eitherenvironment, you had to include postgres.h for the backend case.Let's simplify that.Per buildfarm, some of whose members started throwing warnings aftercommit0c62356 added an Assert in src/port/snprintf.c.It's possible that some other src/port files that use the stanza#ifndef FRONTEND#include "postgres.h"#else#include "postgres_fe.h"#endifcould now be simplified to just say '#include "c.h"'. I have nottested for that, though, and it'd be unlikely to apply for morethan a small number of them.
1 parentcbadba8 commit03c5a00

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

‎src/include/c.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@
3636
*8)random stuff
3737
*9)system-specific hacks
3838
*
39-
* NOTE: since this file is included by both frontend and backend modules, it's
40-
* almost certainly wrong to put an "extern" declaration here. typedefs and
41-
* macros are the kind of thing that might go here.
39+
* NOTE: since this file is included by both frontend and backend modules,
40+
* it's usually wrong to put an "extern" declaration here, unless it's
41+
* ifdef'd so that it's seen in only one case or the other.
42+
* typedefs and macros are the kind of thing that might go here.
4243
*
4344
*----------------------------------------------------------------
4445
*/
@@ -747,6 +748,18 @@ typedef NameData *Name;
747748

748749
#endif/* USE_ASSERT_CHECKING && !FRONTEND */
749750

751+
/*
752+
* ExceptionalCondition is compiled into the backend whether or not
753+
* USE_ASSERT_CHECKING is defined, so as to support use of extensions
754+
* that are built with that #define with a backend that isn't. Hence,
755+
* we should declare it as long as !FRONTEND.
756+
*/
757+
#ifndefFRONTEND
758+
externvoidExceptionalCondition(constchar*conditionName,
759+
constchar*errorType,
760+
constchar*fileName,intlineNumber)pg_attribute_noreturn();
761+
#endif
762+
750763
/*
751764
* Macros to support compile-time assertion checks.
752765
*

‎src/include/postgres.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
* -------------------------------------------------------
2626
*1)variable-length datatypes (TOAST support)
2727
*2)Datum type + support macros
28-
*3)exception handling backend support
2928
*
3029
* NOTES
3130
*
@@ -766,19 +765,4 @@ extern Datum Float8GetDatum(float8 X);
766765
#defineFloat4GetDatumFast(X) PointerGetDatum(&(X))
767766
#endif
768767

769-
770-
/* ----------------------------------------------------------------
771-
*Section 3:exception handling backend support
772-
* ----------------------------------------------------------------
773-
*/
774-
775-
/*
776-
* Backend only infrastructure for the assertion-related macros in c.h.
777-
*
778-
* ExceptionalCondition must be present even when assertions are not enabled.
779-
*/
780-
externvoidExceptionalCondition(constchar*conditionName,
781-
constchar*errorType,
782-
constchar*fileName,intlineNumber)pg_attribute_noreturn();
783-
784768
#endif/* POSTGRES_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp