Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
build: use -fno-strict-aliasing for GCC <= 4.4
Browse files Browse the repository at this point in the history
Revert the previous change to the queue implementation, and instead
disable aliasing optimizations for toolchains using GCC <= 4.4.
  • Loading branch information
Julien Gilli committed Jan 28, 2015
1 parent ae15b94 commit a541b92
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
8 changes: 8 additions & 0 deletions deps/debugger-agent/debugger-agent.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
"include",
],
},
'conditions': [
[ 'gcc_version<=44', {
# GCC versions <= 4.4 do not handle the aliasing in the queue
# implementation, so disable aliasing on these platforms
# to avoid subtle bugs
'cflags': [ '-fno-strict-aliasing' ],
}],
],
"sources": [
"src/agent.cc",
],
Expand Down
6 changes: 6 additions & 0 deletions deps/uv/uv.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
'src/version.c'
],
'conditions': [
[ 'gcc_version<=44', {
# GCC versions <= 4.4 do not handle the aliasing in the queue
# implementation, so disable aliasing on these platforms
# to avoid subtle bugs
'cflags': [ '-fno-strict-aliasing' ],
}],
[ 'OS=="win"', {
'defines': [
'_WIN32_WINNT=0x0600',
Expand Down
6 changes: 6 additions & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@
],

'conditions': [
[ 'gcc_version<=44', {
# GCC versions <= 4.4 do not handle the aliasing in the queue
# implementation, so disable aliasing on these platforms
# to avoid subtle bugs
'cflags': [ '-fno-strict-aliasing' ],
}],
[ 'v8_enable_i18n_support==1', {
'defines': [ 'NODE_HAVE_I18N_SUPPORT=1' ],
'dependencies': [
Expand Down
14 changes: 7 additions & 7 deletions src/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@
typedef void *QUEUE[2];

/* Private macros. */
#define QUEUE_NEXT(q) ((*(q))[0])
#define QUEUE_PREV(q) ((*(q))[1])
#define QUEUE_PREV_NEXT(q) (QUEUE_NEXT((QUEUE *)QUEUE_PREV(q)))
#define QUEUE_NEXT_PREV(q) (QUEUE_PREV((QUEUE *)QUEUE_NEXT(q)))
#define QUEUE_NEXT(q) (*(QUEUE **) &((*(q))[0]))
#define QUEUE_PREV(q) (*(QUEUE **) &((*(q))[1]))
#define QUEUE_PREV_NEXT(q) (QUEUE_NEXT(QUEUE_PREV(q)))
#define QUEUE_NEXT_PREV(q) (QUEUE_PREV(QUEUE_NEXT(q)))

/* Public macros. */
#define QUEUE_DATA(ptr, type, field) \
((type *) ((char *) (ptr) - ((char *) &((type *) 0)->field)))

#define QUEUE_FOREACH(q, h) \
for ((q) = (QUEUE *) QUEUE_NEXT(h); (q) != (h); (q) = (QUEUE *) QUEUE_NEXT(q))
for ((q) = QUEUE_NEXT(h); (q) != (h); (q) = QUEUE_NEXT(q))

#define QUEUE_EMPTY(q) \
((q) == QUEUE_NEXT(q))
((const QUEUE *) (q) == (const QUEUE *) QUEUE_NEXT(q))

#define QUEUE_HEAD(q) \
((QUEUE*)QUEUE_NEXT(q))
(QUEUE_NEXT(q))

#define QUEUE_INIT(q) \
do { \
Expand Down

0 comments on commit a541b92

Please sign in to comment.