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

Commitb0727ae

Browse files
committed
Tidy up definitions of pg_attribute_hot and pg_attribute_cold
1fa22a4 was a quick fix for portability problem I introduced in697e1d0.1fa22a4 adds a few more cases to the preprocessor logic thanI'd have liked. Andres Freund and Dagfinn Ilmari Mannsåker suggested abetter way to do this.In passing, also adjust the only current usage of these macros so that themacro comes before the function's return type in the declaration of thefunction. This now matches what the definition of the function does.Discussion:https://postgr.es/m/20200625163553.lt6wocbjhklp5pl4@alap3.anarazel.deDiscussion:https://postgr.es/m/87pn43bmok.fsf@wibble.ilmari.org
1 parentec05baf commitb0727ae

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

‎src/include/c.h‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@
104104
* XLC: https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.2/com.ibm.xlc131.aix.doc/language_ref/type_attrib.html
105105
*/
106106

107+
/*
108+
* For compilers which don't support __has_attribute, we just define
109+
* __has_attribute(x) to 0 so that we can define macros for various
110+
* __attribute__s more easily below.
111+
*/
112+
#ifndef__has_attribute
113+
#define__has_attribute(attribute) 0
114+
#endif
115+
107116
/* only GCC supports the unused attribute */
108117
#ifdef__GNUC__
109118
#definepg_attribute_unused() __attribute__((unused))
@@ -195,8 +204,6 @@
195204
* Marking certain functions as "hot" or "cold" can be useful to assist the
196205
* compiler in arranging the assembly code in a more efficient way.
197206
*/
198-
#if defined(__has_attribute)
199-
200207
#if__has_attribute (cold)
201208
#definepg_attribute_cold __attribute__((cold))
202209
#else
@@ -209,11 +216,6 @@
209216
#definepg_attribute_hot
210217
#endif
211218

212-
#else
213-
#definepg_attribute_hot
214-
#definepg_attribute_cold
215-
#endif
216-
217219
/*
218220
* Mark a point as unreachable in a portable fashion. This should preferably
219221
* be something that the compiler understands, to aid code generation.

‎src/include/utils/elog.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
externboolmessage_level_is_interesting(intelevel);
161161

162162
externboolerrstart(intelevel,constchar*domain);
163-
externboolpg_attribute_colderrstart_cold(intelevel,constchar*domain);
163+
externpg_attribute_coldboolerrstart_cold(intelevel,constchar*domain);
164164
externvoiderrfinish(constchar*filename,intlineno,constchar*funcname);
165165

166166
externinterrcode(intsqlerrcode);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp