[ODE] [patch] gcc detection

Adam D. Moss adam at gimp.org
Thu Jun 23 18:15:56 MST 2005


Adam D. Moss wrote:
> GCC isn't always called 'g++', in which case you'll likely end
> up with a dysfunctional OPCODE/tricollider because the GCC+OPCODE
> workaround doesn't kick-in.
> 
> I'll be putting this patch on the trunk soon if there aren't
> objections.

This patch goes on top of the previous, and allows -O2 instead
of -O1, adding -fno-strict-aliasing instead, since after some
fiddling it seems that the implicit -fstrict-aliasing in -O2
is what OPCODE hates.  (This implies that OPCODE has an aliasing
problem that should really be fixed, but this is a very unobtrusive
workaround.)

--adam
-- 
Adam D. Moss   -   adam at gimp.org
-------------- next part --------------
Index: Makefile
===================================================================
--- Makefile	(revision 4638)
+++ Makefile	(working copy)
@@ -182,10 +182,10 @@
 # which is OPC_TreeCollider (if you identify the other, which causes
 # problems with trimesh-trimesh collisions, then let us know).
 ifeq ($(CC),g++)
-OPCODE/%.o: OPT=1
+OPCODE/%.o: C_FLAGS+=-fno-strict-aliasing
 endif
 ifeq ($(I_AM_GCC),yes)
-OPCODE/%.o: OPT=1
+OPCODE/%.o: C_FLAGS+=-fno-strict-aliasing
 endif
 
 endif
@@ -334,10 +334,10 @@
 	-$(DEL_CMD) OPCODE/*.obj OPCODE/*.o OPCODE/Ice/*.obj OPCODE/Ice/*.o
 
 %$(OBJ): %.c
-	$(CC) $(C_FLAGS) $(C_INC)$(INCPATH) $(DEFINES) $(C_OPT)1 $(C_OUT)$@ $<
+	$(CC) $(C_INC)$(INCPATH) $(DEFINES) $(C_OPT)1 $(C_FLAGS) $(C_OUT)$@ $<
 
 %$(OBJ): %.cpp
-	$(CC) $(C_FLAGS) $(C_INC)$(INCPATH) $(INC_OPCODE) $(DEFINES) $(C_OPT)$(OPT) $(C_OUT)$@ $<
+	$(CC) $(C_INC)$(INCPATH) $(INC_OPCODE) $(DEFINES) $(C_OPT)$(OPT) $(C_FLAGS) $(C_OUT)$@ $<
 
 %.exe: %$(OBJ)
 	$(CC) $(C_EXEOUT)$@ $< $(ODE_LIB) $(DRAWSTUFF_LIB) $(RESOURCE_FILE) $(LINK_OPENGL) $(LINK_MATH)


More information about the ODE mailing list