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

Commit

Permalink
mdbx: workaround for "alignment-reduction-ignored" lcc's bug.
Browse files Browse the repository at this point in the history
Change-Id: I000bfaffd78ef7b6e27d6178bc2a5defc32cc357
  • Loading branch information
erthink committed Mar 7, 2018
1 parent a209958 commit c267a71
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ CXX ?= g++
XCFLAGS ?= -DNDEBUG=1 -DMDBX_DEBUG=0 -DLIBMDBX_EXPORTS=1
CFLAGS ?= -O2 -g3 -Wall -Werror -Wextra -ffunction-sections -fPIC -fvisibility=hidden
CFLAGS += -D_GNU_SOURCE=1 -std=gnu11 -pthread $(XCFLAGS)

# temporary workaround for lcc's bug
TARGET_ARCH_e2k = $(shell (export LC_ALL=C; ($(CC) --version 2>&1; $(CC) -v 2>&1) | grep -q -i 'e2k' && echo yes || echo no))
ifeq ($(TARGET_ARCH_e2k),yes)
TARGET_ARCH := e2k
CFLAGS += -mtune=native -Wno-alignment-reduction-ignored
endif

CXXFLAGS = -std=c++11 $(filter-out -std=gnu11,$(CFLAGS))
TESTDB ?= $(shell [ -d /dev/shm ] && echo /dev/shm || echo /tmp)/mdbx-check.db
TESTLOG ?= $(shell [ -d /dev/shm ] && echo /dev/shm || echo /tmp)/mdbx-check.log
Expand Down
12 changes: 12 additions & 0 deletions src/bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@
#endif
#endif /* -Wconstant-logical-operand */

#if __has_warning("-Walignment-reduction-ignored") || defined(__e2k__) || defined(__ICC)
#if defined(__ICC)
#pragma warning(disable: 3453 1366)
#elif defined(__clang__)
#pragma clang diagnostic ignored "-Walignment-reduction-ignored"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Walignment-reduction-ignored"
#else
#pragma warning disable "alignment-reduction-ignored"
#endif
#endif /* -Wno-constant-logical-operand */

#include "./osal.h"

/* *INDENT-ON* */
Expand Down

0 comments on commit c267a71

Please sign in to comment.