1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-26 11:52:25 +00:00

Update how we configure gcc / clang command lines. (#103)

* Move clang/gcc options into makefile-header.

This puts all of the shared options into a single place so that
we can easily update it.

* Add -fwrapv to the clang/gcc command lines.

This is a step along the way to fixing interlisp/medley#90.

Enabling `-fwrapv` will let overflow checks that rely upon undefined
behavior to work correctly. Without this, with modern versions of
clang and gcc, the overflow checks in the C code are eliminated
by the compiler, resulting in incorrect behavior on the part of
Maiko.

See the linked bug for details and discussion.

Hopefully, this usage of `-fwrapv` will go away once we're using
the correct compiler builtins to detect and handle overflow
correctly.
This commit is contained in:
Bruce Mitchener
2020-12-20 11:16:31 +07:00
committed by GitHub
parent 942b22886e
commit 810e33125b
11 changed files with 17 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
# Options for MacOS, x86 processor, X windows
CC = clang -m32 -std=gnu89 -funsigned-char -fno-strict-aliasing
CC = clang -m32 $(CLANG_CFLAGS)
OEXT=.o
XFILES = $(OBJECTDIR)xmkicon.o \

View File

@@ -1,6 +1,6 @@
# Options for MacOS, x86 processor, X windows
CC = clang -std=gnu89 -funsigned-char -fno-strict-aliasing
CC = clang $(CLANG_CFLAGS)
OEXT=.o
XFILES = $(OBJECTDIR)xmkicon.o \

View File

@@ -1,6 +1,6 @@
# Options for MacOS, x86 processor, X windows
CC = clang -m64 -std=gnu89 -funsigned-char -fno-strict-aliasing
CC = clang -m64 $(CLANG_CFLAGS)
OEXT=.o
XFILES = $(OBJECTDIR)xmkicon.o \

View File

@@ -13,6 +13,10 @@ RANLIB = ranlib
AR = ar rcv
ANSICC = $(CC)
# Compiler flags
CLANG_CFLAGS = -std=gnu89 -funsigned-char -fno-strict-aliasing -fwrapv
GCC_CFLAGS = -std=gnu89 -funsigned-char -fno-strict-aliasing -fwrapv
# for the files that need to be included in byte-swapped implementations:
BYTESWAPFILES =
SXHASHFILE =

View File

@@ -1,6 +1,6 @@
# Options for MacOS, x86 processor, X windows, for INIT processing
CC = clang -m32 -std=gnu89 -Wimplicit-function-declaration
CC = clang -m32 $(CLANG_CFLAGS)
OEXT=.o
XFILES = $(OBJECTDIR)xmkicon.o \

View File

@@ -1,7 +1,7 @@
# Options for Linux, Intel 386/486 and X-Window
#CC = gcc -m32 -std=gnu89 -fno-omit-frame-pointer -Wall -Wextra -fwrapv -fno-aggressive-loop-optimizations -fno-strict-aliasing
CC = clang -m32 -std=gnu89 -funsigned-char -fno-strict-aliasing
#CC = gcc -m32 $(GCC_CFLAGS) -fno-omit-frame-pointer -Wall -Wextra -fno-aggressive-loop-optimizations
CC = clang -m32 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \

View File

@@ -1,7 +1,7 @@
# Options for Linux, Intel 386/486 and X-Window
#CC = gcc -m32 -std=gnu89 -fno-omit-frame-pointer -Wall -Wextra -fwrapv -fno-aggressive-loop-optimizations -fno-strict-aliasing
CC = clang -m32 -std=gnu89 -funsigned-char -fno-strict-aliasing
#CC = gcc -m32 $(GCC_CFLAGS) -fno-omit-frame-pointer -Wall -Wextra -fno-aggressive-loop-optimizations
CC = clang -m32 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \

View File

@@ -1,7 +1,7 @@
# Options for Linux, Intel x86_64 and X-Window
#CC = gcc -m64 -std=gnu89 -fno-omit-frame-pointer -Wall -Wextra -fwrapv -fno-aggressive-loop-optimizations -fno-strict-aliasing
CC = clang -m64 -std=gnu89 -funsigned-char -fno-strict-aliasing
#CC = gcc -m64 $(GCC_CFLAGS) -fno-omit-frame-pointer -Wall -Wextra -fno-aggressive-loop-optimizations
CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \

View File

@@ -10,7 +10,7 @@
#* */
#************************************************************************/
CC = clang -m32 -std=gnu89 -funsigned-char -fno-strict-aliasing
CC = clang -m32 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \

View File

@@ -13,7 +13,7 @@
#************************************************************************/
# Setup for using gcc
# CC = gcc -std=gnu89 -funsigned-char
# CC = gcc $(GCC_CFLAGS)
# Setup for using Solaris Developer Studio 12.6 cc
# CC = cc -m32 -funsigned-char

View File

@@ -10,7 +10,7 @@
#* */
#************************************************************************/
CC = clang -std=gnu89 -funsigned-char -fno-strict-aliasing
CC = clang $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \