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

Commit434e6e1

Browse files
committed
Improve implementation of pg_attribute_always_inline.
Avoid compiler warnings on MSVC (which doesn't want to see both__forceinline and inline) and ancient GCC (which doesn't have__attribute__((always_inline))).Don't force inline-ing when building at -O0, as the programmer is probablyhoping for exact source-to-object-line correspondence in that case.(For the moment this only works for GCC; maybe we can extend it later.)Make pg_attribute_always_inline be syntactically a drop-in replacementfor inline, rather than an additional wart.And improve the comments.Thomas Munro and Michail Nikolaev, small tweaks by meDiscussion:https://postgr.es/m/32278.1514863068@sss.pgh.pa.usDiscussion:https://postgr.es/m/CANtu0oiYp74brgntKOxgg1FK5+t8uQ05guSiFU6FYz_5KUhr6Q@mail.gmail.com
1 parente0a0dec commit434e6e1

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

‎src/backend/executor/nodeHashjoin.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ static void ExecParallelHashJoinPartitionOuter(HashJoinState *node);
161161
* the other one is "outer".
162162
* ----------------------------------------------------------------
163163
*/
164-
pg_attribute_always_inline
165-
staticinlineTupleTableSlot*
164+
staticpg_attribute_always_inlineTupleTableSlot*
166165
ExecHashJoinImpl(PlanState*pstate,boolparallel)
167166
{
168167
HashJoinState*node=castNode(HashJoinState,pstate);

‎src/include/c.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,21 @@
146146
#definepg_attribute_noreturn()
147147
#endif
148148

149-
/* GCC, Sunpro and XLC support always_inline via __attribute__ */
150-
#if defined(__GNUC__)
151-
#definepg_attribute_always_inline __attribute__((always_inline))
152-
/* msvc via a special keyword */
149+
/*
150+
* Use "pg_attribute_always_inline" in place of "inline" for functions that
151+
* we wish to force inlining of, even when the compiler's heuristics would
152+
* choose not to. But, if possible, don't force inlining in unoptimized
153+
* debug builds.
154+
*/
155+
#if (defined(__GNUC__)&&__GNUC__>3&& defined(__OPTIMIZE__))|| defined(__SUNPRO_C)|| defined(__IBMC__)
156+
/* GCC > 3, Sunpro and XLC support always_inline via __attribute__ */
157+
#definepg_attribute_always_inline __attribute__((always_inline)) inline
153158
#elif defined(_MSC_VER)
159+
/* MSVC has a special keyword for this */
154160
#definepg_attribute_always_inline __forceinline
155161
#else
156-
#definepg_attribute_always_inline
162+
/* Otherwise, the best we can do is to say "inline" */
163+
#definepg_attribute_always_inline inline
157164
#endif
158165

159166
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp