Mercurial > forge
changeset 11646:b257244ad466 octave-forge
Hopefully fix strict aliasing issues.
author | i7tiol |
---|---|
date | Mon, 22 Apr 2013 18:41:18 +0000 |
parents | bd5a8f1bdfb8 |
children | 3fd12a47467e |
files | main/database/src/Makefile.in main/database/src/command.cc main/database/src/configure.ac main/database/src/converters_arr_comp.cc |
diffstat | 4 files changed, 24 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/main/database/src/Makefile.in Mon Apr 22 13:40:13 2013 +0000 +++ b/main/database/src/Makefile.in Mon Apr 22 18:41:18 2013 +0000 @@ -1,3 +1,8 @@ +# We rely on g++ features, configure assures CXX=g++. +CXX := @CXX@ + +CXXFLAGS_NSA := "$(CXXFLAGS) -g -O2 -fno-strict-aliasing" + OBJECTS := __pq_connect__.o pq_close.o pq_exec.o converters.o \ converters_arr_comp.o pq_connection.o command.o \ pq_update_types.o pq_lo.o @@ -5,9 +10,16 @@ pq_interface.oct: $(OBJECTS) @MKOCTFILE@ -o pq_interface.oct -L`@PG_CONFIG@ --libdir` -lpq $(OBJECTS) +converters.o: converters.cc converters.h wrap_endian.h + CXX=$(CXX) CXXFLAGS=$(CXXFLAGS_NSA) @MKOCTFILE@ -I`@PG_CONFIG@ --includedir` -c converters.cc + +converters_arr_comp.o: converters_arr_comp.cc converters.h wrap_endian.h \ + pq_connection.h command.h + CXX=$(CXX) CXXFLAGS=$(CXXFLAGS_NSA) @MKOCTFILE@ -I`@PG_CONFIG@ --includedir` -c converters_arr_comp.cc + # be on the safe side with respect to include files %.o: %.cc converters.h pq_connection.h command.h - @MKOCTFILE@ -I`@PG_CONFIG@ --includedir` -c $< + CXX=$(CXX) @MKOCTFILE@ -I`@PG_CONFIG@ --includedir` -c $< .PHONY: clean clean: ; rm -f *.o *.oct
--- a/main/database/src/command.cc Mon Apr 22 13:40:13 2013 +0000 +++ b/main/database/src/command.cc Mon Apr 22 18:41:18 2013 +0000 @@ -668,10 +668,12 @@ char header [COPY_HEADER_SIZE]; memset (header, 0, COPY_HEADER_SIZE); strcpy (header, "PGCOPY\n\377\r\n\0"); - *((uint32_t *) (&header[11])) = htobe32 (uint32_t (oids) << 16); + uint32_t tpu32 = htobe32 (uint32_t (oids) << 16); + memcpy (&header[11], &tpu32, 4); char trailer [2]; - *((int16_t *) (&trailer)) = htobe16 (int16_t (-1)); + int16_t tp16 = htobe16 (int16_t (-1)); + memcpy (&trailer, &tp16, 2); if (PQputCopyData (cptr, header, COPY_HEADER_SIZE) == -1) {
--- a/main/database/src/configure.ac Mon Apr 22 13:40:13 2013 +0000 +++ b/main/database/src/configure.ac Mon Apr 22 18:41:18 2013 +0000 @@ -7,10 +7,16 @@ # Checks for programs. AC_PROG_CXX +if test "$GXX" != yes; then +AC_MSG_ERROR([This package needs the GNU C++ compiler, which wasn't found.], 1); +fi + AC_CHECK_PROG(OCTAVE, octave, octave) AC_CHECK_PROG(MKOCTFILE, mkoctfile, mkoctfile) AC_CHECK_PROG(PG_CONFIG, pg_config, pg_config) -if test -z "$PG_CONFIG"; then exit 1; fi +if test -z "$PG_CONFIG"; then +AC_MSG_ERROR([pg_config not found], 1); +fi # Checks for libraries. AC_CHECK_LIB([pq], [PQconnectdb])
--- a/main/database/src/converters_arr_comp.cc Mon Apr 22 13:40:13 2013 +0000 +++ b/main/database/src/converters_arr_comp.cc Mon Apr 22 18:41:18 2013 +0000 @@ -24,7 +24,6 @@ #include <stdint.h> -#include "wrap_endian.h" #include "command.h" octave_idx_type command::count_row_major_order (dim_vector &dv,