clang compatibility
authorebensza <bence.janos.szabo@ericsson.com>
Wed, 11 May 2016 15:14:28 +0000 (17:14 +0200)
committerebensza <bence.janos.szabo@ericsson.com>
Wed, 11 May 2016 15:14:28 +0000 (17:14 +0200)
Signed-off-by: ebensza <bence.janos.szabo@ericsson.com>
compiler2/makefile.c
core/Array.hh
core/Optional.hh
function_test/BER_EncDec/Makefile
function_test/RAW_EncDec/Makefile
function_test/Text_EncDec/Makefile
function_test/XER_EncDec/Makefile
regression_test/XML/XmlWorkflow/PIPEasp_CNL113334/test/Makefile
regression_test/logger/emergency_logging/Makefile
regression_test/logger/logtest/Makefile

index c6bc327e83c9a21d21c373eb4d1a125ad7d13bff..d77f45226ff9027531ba951fb3ff764c16c046ff 100644 (file)
@@ -1874,10 +1874,19 @@ static void print_makefile(struct makefile_struct *makefile)
       , titan_dir ? titan_dir : "");
     if (titan_dir) Free(titan_dir);
 
+    boolean cxx_free = FALSE;
     if (makefile->cxxcompiler) {
       cxx = makefile->cxxcompiler;
     } else {
+#ifdef __clang__
+      unsigned int
+        compiler_major = __clang_major__,
+        compiler_minor = __clang_minor__;
+      cxx = mprintf("clang++-%u.%u", compiler_major, compiler_minor);
+      cxx_free = TRUE;
+#else
       cxx = "g++";
+#endif
     }
 
     fprintf(fp, "\n# Your platform: (SOLARIS, SOLARIS8, LINUX, FREEBSD or "
@@ -1944,6 +1953,11 @@ static void print_makefile(struct makefile_struct *makefile)
         "CXXDEPFLAGS = -%s\n\n", strstr(cxx, "g++") ? "MM" : "xM1");
     }
 
+    if (cxx_free) {
+      Free((char*)cxx);
+      cxx = NULL;
+    }
+    
     if (makefile->preprocess || makefile->ttcn3_prep_includes ||  makefile->ttcn3_prep_defines) {
       fputs("# Flags for preprocessing TTCN-3 files:\n"
             "CPPFLAGS_TTCN3 =", fp);
index b04a6c3c6c79010e0d51bd871ec6bbd4c5ebfb6b..9de9e01d39b8d36e1be0288e9437f4f4bcdb2cfb 100644 (file)
@@ -184,7 +184,10 @@ class VALUE_ARRAY : public Base_Type
 public:
   // This class use the compiler-generated copy constructor and
   // copy assignment.
-
+    
+  // User defined default constructor, because with clang the text2ttcn test
+  // won't compile
+  VALUE_ARRAY() : array_elements(){};
   boolean operator==(const VALUE_ARRAY& other_value) const;
   inline boolean operator!=(const VALUE_ARRAY& other_value) const
     { return !(*this == other_value); }
index 5952c2f8cf00e91978421645eda25d67b4780815..59c6aaed22b8fd9b9df050d5a70a1a1e87a9325c 100644 (file)
@@ -194,8 +194,8 @@ public:
   template <typename T_tmp>
   inline boolean operator!=(const T_tmp& other_value) const
     { return !is_equal(other_value); }
-#ifdef __SUNPRO_CC
-  /* Note: Without these functions the Sun Workshop Pro C++ compiler reports
+#if defined(__SUNPRO_CC) || defined(__clang__)
+  /* Note: Without these functions the Sun Workshop Pro C++ compiler or clang reports
    * overloading ambiguity when comparing an optional charstring field with an
    * optional universal charstring. */
   template <typename T_tmp>
index 40abd55267894a0e93c3739c0ea04e648907c422..6dbb2c13d24fa789eb30ac9fc72f6bda43d8b78c 100644 (file)
@@ -50,7 +50,7 @@ PLATFORM = SOLARIS
 endif
 
 # Your C++ compiler:
-CXX = g++
+#CXX = g++
 
 # Flags for the C++ preprocessor (and makedepend as well):
 CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include -I$(XMLDIR)/include/libxml2
index 904ead16d79e0b034db8b92a286ab1717b5f1705..8b7f6f3598206c1d283fa99bef07a283311b9526 100644 (file)
@@ -45,7 +45,7 @@ PLATFORM = SOLARIS
 endif
 
 # Your C++ compiler:
-CXX = g++
+#CXX = g++
 
 # Flags for the C++ preprocessor (and makedepend as well):
 CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include -I$(XMLDIR)/include/libxml2
index 21721645b3ad0825ad798e2c73daf3f3458ab5fc..c276d7e747c70d73930af9382e9aa614435bd452 100644 (file)
@@ -41,7 +41,7 @@ PLATFORM = SOLARIS
 endif
 
 # Your C++ compiler:
-CXX = g++
+#CXX = g++
 
 # Flags for the C++ preprocessor (and makedepend as well):
 CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include -I$(XMLDIR)/include/libxml2
index 0e88271e12d6302d1a78f5e0da65520e8c91e28d..94ee3ccf76521bdcc66d8dfe575932c4b577aa92 100644 (file)
@@ -41,7 +41,7 @@ PLATFORM = SOLARIS
 endif
 
 # Your C++ compiler:
-CXX = g++
+#CXX = g++
 
 # Flags for the C++ preprocessor (and makedepend as well):
 CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include -I$(XMLDIR)/include/libxml2
index 18c7849cd342818890c9cbbe0e2baf921251fa32..9c584367260cbbbb6a0869cd450a492e3f7e080a 100644 (file)
 #   Pandi, Krisztian
 #   Raduly, Csaba
 #   Szabados, Kristof
+#   Szabo, Bence Janos
 #
 ##############################################################################
-# This Makefile was generated by the Makefile Generator
-# of the TTCN-3 Test Executor version 1.7.pre0 build 2
-# for Attila Balasko (ethbaat@ehubuux110) on Thu Jan 18 09:37:03 2007
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
 
+.SUFFIXES: .ttcn .hh
+.PHONY: all clean dep run
 
-# The following make commands are available:
-# - make, make all     Builds the executable test suite.
-# - make archive       Archives all source files.
-# - make check         Checks the semantics of TTCN-3 and ASN.1 modules.
-# - make clean         Removes all generated files.
-# - make compile       Translates TTCN-3 and ASN.1 modules to C++.
-# - make dep           Creates/updates dependency list.
-# - make objects       Builds the object files without linking the executable.
+TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX)
 
-#
-# Set these variables...
-#
-
-# The path of your TTCN-3 Test Executor installation:
-# Uncomment this line to override the environment variable.
-# TTCN3_DIR =
-
-# Your platform: (SOLARIS, SOLARIS8, LINUX, FREEBSD or WIN32)
-PLATFORM = SOLARIS8
-
-# Your C++ compiler:
-CXX = g++
-
-# Flags for the C++ preprocessor (and makedepend as well):
-CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include
-
-# Flags for the C++ compiler:
-CXXFLAGS = -Wall
-
-# Flags for the linker:
-LDFLAGS =
-
-# Flags for the TTCN-3 and ASN.1 compiler:
-COMPILER_FLAGS = 
-
-# Execution mode: (either ttcn3 or ttcn3-parallel)
-TTCN3_LIB = ttcn3-parallel
-
-# The path of your OpenSSL installation:
-# If you do not have your own one, leave it unchanged.
-OPENSSL_DIR = $(TTCN3_DIR)
-
-# Directory to store the archived source files:
-# Note: you can set any directory except ./archive
-ARCHIVE_DIR = backup
-
-#
-# You may change these variables. Add your files if necessary...
-#
-
-# TTCN-3 modules of this project:
 TTCN3_MODULES = PIPEasp_PortType.ttcn PIPEasp_Types.ttcn
 
-# ASN.1 modules of this project:
-ASN1_MODULES =
-
-# C++ source & header files generated from the TTCN-3 & ASN.1 modules of
-# this project:
-GENERATED_SOURCES = PIPEasp_PortType.cc PIPEasp_Types.cc
-GENERATED_HEADERS = PIPEasp_PortType.hh PIPEasp_Types.hh
+GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc)
+GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh)
 ifdef CODE_SPLIT
 GENERATED_SOURCES := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), .cc _seq.cc _set.cc  _seqof.cc _setof.cc _union.cc))
 endif
 
-# C/C++ Source & header files of Test Ports, external functions and
-# other modules:
 USER_SOURCES = PIPEasp_PT.cc
 USER_HEADERS = PIPEasp_PT.hh
 
-# Object files of this project that are needed for the executable test suite:
-OBJECTS = PIPEasp_PortType.o PIPEasp_Types.o PIPEasp_PT.o
+OBJECTS = $(GENERATED_SOURCES:.cc=.o) $(USER_SOURCES:.cc=.o)
 
-# Other files of the project (Makefile, configuration files, etc.)
-# that will be added to the archived source files:
-OTHER_FILES = Makefile
+TARGET = PIPEasp_PortType$(EXESUFFIX)
 
-# The name of the executable test suite:
-TARGET = PIPEasp_PortType
+all: $(TARGET)
 
-#
-# Do not modify these unless you know what you are doing...
-# Platform specific additional libraries:
-#
-SOLARIS_LIBS = -lsocket -lnsl
-SOLARIS8_LIBS = -lsocket -lnsl
-LINUX_LIBS =
-FREEBSD_LIBS =
-WIN32_LIBS =
-
-#
-# Rules for building the executable...
-#
-
-all: $(TARGET) ;
-
-objects: $(OBJECTS) ;
-
-$(TARGET): $(OBJECTS)
-       $(CXX) $(LDFLAGS) -o $@ $(OBJECTS) \
-       -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \
-       -L$(OPENSSL_DIR)/lib -lcrypto $($(PLATFORM)_LIBS)
-
-.cc.o .c.o:
-       $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
+$(TARGET): $(GENERATED_SOURCES) $(USER_SOURCES)
+       $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) -L$(OPENSSL_DIR)/lib -lcrypto $($(PLATFORM)_LIBS)
 
 $(GENERATED_SOURCES) $(GENERATED_HEADERS): compile
-       @if [ ! -f $@ ]; then rm -f compile; $(MAKE) compile; fi
-
-check: $(TTCN3_MODULES) $(ASN1_MODULES)
-       $(TTCN3_DIR)/bin/compiler -s $(COMPILER_FLAGS) \
-       $(TTCN3_MODULES) $(PREPROCESSED_TTCN3_MODULES) $(ASN1_MODULES)
+       @if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi
 
 compile: $(TTCN3_MODULES) $(ASN1_MODULES)
-       $(TTCN3_DIR)/bin/compiler $(COMPILER_FLAGS) \
-       $(TTCN3_MODULES) $(ASN1_MODULES) - $?
-       touch $@
-
-clean:
+       $(filter-out -Nold -E, $(TTCN3_COMPILER)) $(COMPILER_FLAGS) $^ 
+       touch compile
+       
+clean distclean:
        -rm -f $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \
-       $(GENERATED_SOURCES) compile \
-       tags *.log
-
-dep: $(GENERATED_SOURCES) $(USER_SOURCES)
-       makedepend $(CPPFLAGS) $(GENERATED_SOURCES) $(USER_SOURCES)
-
-archive:
-       mkdir -p $(ARCHIVE_DIR)
-       tar -cvhf - $(TTCN3_MODULES) $(ASN1_MODULES) \
-       $(USER_HEADERS) $(USER_SOURCES) $(OTHER_FILES) \
-       | gzip >$(ARCHIVE_DIR)/`basename $(TARGET) .exe`-`date '+%y%m%d-%H%M'`.tgz
-
-#
-# Add your rules here if necessary...
-#
+       $(GENERATED_SOURCES) *.log Makefile.bak
 
+dep: $(GENERATED_SOURCES)
+       makedepend $(CPPFLAGS) $(GENERATED_SOURCES)
\ No newline at end of file
index 82b8bb887512248c1c3fbf931c849abe300a6000..ede1e1ba0ae76738f4e828eea8927289f1cad7ff 100644 (file)
@@ -34,7 +34,7 @@ include ${TOPDIR}/Makefile.regression
 
 # Your C++ compiler:
 # (if you change the platform, you may need to change the compiler)
-CXX = g++
+#CXX = g++
 
 # Flags for the C++ preprocessor (and makedepend as well):
 CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include
index 507f557719f17624d411a1fc5a1ed650cbbddf3c..dc43c4901e925a41a88200cd7893ed81383b5dcf 100644 (file)
@@ -34,7 +34,7 @@ include ${TOPDIR}/Makefile.regression
 
 # Your C++ compiler:
 # (if you change the platform, you may need to change the compiler)
-CXX = g++
+#CXX = g++
 
 # Flags for the C++ preprocessor (and makedepend as well):
 CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include
This page took 0.032693 seconds and 5 git commands to generate.