Quellcode durchsuchen

clean up in Makefile.am

Leon Urbas vor 11 Jahren
Ursprung
Commit
3f4d910c22
5 geänderte Dateien mit 39 neuen und 34 gelöschten Zeilen
  1. 14 6
      Makefile.am
  2. 3 3
      configure.ac
  3. 7 24
      examples/src/Makefile.am
  4. 0 1
      src/ua_services_attribute.c
  5. 15 0
      tests/check_memory.c

+ 14 - 6
Makefile.am

@@ -1,16 +1,24 @@
-AM_CPPFLAGS = -std=c99 -pedantic -pipe -fPIC -fno-exceptions -fstack-protector -Wl,-z,relro -Wl,-z,now -fvisibility=hidden -W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unused-label -Wpointer-arith -Wformat -Wreturn-type -Wsign-compare -Wmultichar -Wformat-nonliteral -Winit-self -Wuninitialized -Wno-deprecated -Wformat-security -Werror
+AM_CFLAGS  = -std=c99 -pedantic -pipe -fPIC -fno-exceptions -fstack-protector -Wl,-z,relro -Wl,-z,now -fvisibility=hidden -W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unused-label -Wpointer-arith -Wformat -Wreturn-type -Wsign-compare -Wmultichar -Wformat-nonliteral -Winit-self -Wuninitialized -Wno-deprecated -Wformat-security -Werror
+AM_LDFLAGS =
+AM_LDADD =
+
 if DEBUG
-AM_CPPFLAGS += -g3 -O0
+AM_CFLAGS += -g3 -O0
 else
-AM_CPPFLAGS += -O2 
+AM_CFLAGS += -O2 
 endif
 
 if COVERAGE
-AM_CPPFLAGS += --coverage
-AM_LDFLAGS = --coverage
+AM_CFLAGS  += --coverage
+AM_LDFLAGS += --coverage
+endif
+
+if MULTITHREADING
+AM_LDADD += -lpthread
 endif
 
-export GLOBAL_AM_CFLAGS = $(AM_CPPFLAGS)
+export GLOBAL_AM_CFLAGS = $(AM_CFLAGS)
+export GLOBAL_AM_LDADD = $(AM_LDADD)
 
 SUBS=tool include src
 if HAVE_CHECK

+ 3 - 3
configure.ac

@@ -32,9 +32,9 @@ AC_ARG_ENABLE(debug,
 AS_HELP_STRING([--enable-debug],
                [enable debugging, default: no]),
 	[case "${enableval}" in
-        	yes) debug=true, verbose=false ;;
-             	no)  debug=false, verbose=false ;;
-             	verbose) debug=true, verbose=true ;;
+        	yes) debug=true; verbose=false ;;
+             	no)  debug=false; verbose=false ;;
+             	verbose) debug=true; verbose=true ;;
              	*)   AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; 
 	esac],[debug=false])
 AM_CONDITIONAL(DEBUG, test x"$debug" = x"true")

+ 7 - 24
examples/src/Makefile.am

@@ -1,35 +1,18 @@
-if MULTITHREADING
-MT_LDADD = -lpthread
-else
-MT_LDADD =
-endif
-
-if COVERAGE
-COV_LDFLAGS = --coverage
-else
-COV_LDFLAGS = 
-endif
-
 if MULTITHREADING
 bin_PROGRAMS= $(top_builddir)/bin/exampleServerMT 
-else
-bin_PROGRAMS= $(top_builddir)/bin/exampleServer $(top_builddir)/bin/exampleServerACPLT
-endif
 
-#__top_builddir__bin_exampleServer_LDFLAGS = -all-static
-if MULTITHREADING
 __top_builddir__bin_exampleServerMT_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
 __top_builddir__bin_exampleServerMT_SOURCES = opcuaServerMT.c networklayer.c
-__top_builddir__bin_exampleServerMT_LDADD= $(top_builddir)/lib/libopen62541.a $(MT_LDADD)
-__top_builddir__bin_exampleServerMT_LDFLAGS= $(COV_LDFLAGS)
+__top_builddir__bin_exampleServerMT_LDADD= $(top_builddir)/lib/libopen62541.a $(GLOBAL_AM_LDADD)
+
 else
+bin_PROGRAMS= $(top_builddir)/bin/exampleServer $(top_builddir)/bin/exampleServerACPLT
+
 __top_builddir__bin_exampleServer_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
 __top_builddir__bin_exampleServer_SOURCES = opcuaServer.c networklayer.c
-__top_builddir__bin_exampleServer_LDADD= $(top_builddir)/lib/libopen62541.a $(MT_LDADD)
-__top_builddir__bin_exampleServer_LDFLAGS= $(COV_LDFLAGS)
+__top_builddir__bin_exampleServer_LDADD= $(top_builddir)/lib/libopen62541.a $(GLOBAL_AM_LDADD)
 
 __top_builddir__bin_exampleServerACPLT_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
 __top_builddir__bin_exampleServerACPLT_SOURCES = opcuaServerACPLT.c networklayer.c
-__top_builddir__bin_exampleServerACPLT_LDADD= $(top_builddir)/lib/libopen62541.a $(MT_LDADD)
-__top_builddir__bin_exampleServerACPLT_LDFLAGS= $(COV_LDFLAGS)
-endif
+__top_builddir__bin_exampleServerACPLT_LDADD= $(top_builddir)/lib/libopen62541.a $(GLOBAL_AM_LDADD)
+endif

+ 0 - 1
src/ua_services_attribute.c

@@ -111,7 +111,6 @@ static UA_DataValue * service_read_node(Application *app, const UA_ReadValueId *
 		// FIXME: delete will be called on all the members of v, so essentially
 		// the item will be removed from the namespace.
 		v->value = ((UA_VariableNode *)node)->value; // be careful not to release the node before encoding the message
-
 		break;
 	case UA_ATTRIBUTEID_DATATYPE:
 		v->encodingMask = UA_DATAVALUE_ENCODINGMASK_STATUSCODE;

+ 15 - 0
tests/check_memory.c

@@ -11,6 +11,20 @@
 #include "opcua.h"
 #include "check.h"
 
+START_TEST (newAndEmptyObjectShallBeDeleted)
+{
+	// given
+	UA_Int32 retval;
+	void* obj;
+	// when
+	retval = UA_[_i].new(&obj);
+	retval |= UA_[_i].delete(obj);
+	// then
+	ck_assert_int_eq(retval,UA_SUCCESS);
+}
+END_TEST
+
+
 START_TEST (encodeShallYieldDecode)
 {
 	void *obj1 = UA_NULL, *obj2 = UA_NULL;
@@ -78,6 +92,7 @@ int main() {
 
 	Suite *s = suite_create("testMemoryHandling");
 	TCase *tc = tcase_create("Empty Objects");
+	tcase_add_loop_test(tc, newAndEmptyObjectShallBeDeleted,UA_BOOLEAN,UA_INVALIDTYPE-1);
 	tcase_add_loop_test(tc, encodeShallYieldDecode,UA_BOOLEAN,UA_INVALIDTYPE-1);
 	suite_add_tcase(s,tc);
 	tc = tcase_create("Truncated Buffers");