I'm still testing, and I've got to go through the other tests that build 
dynamic libraries in order to add the LLDB_TEST_API macro to the exported 
functions.


http://reviews.llvm.org/D8277

Files:
  test/lang/c/shared_lib/foo.h
  test/make/Makefile.rules
  test/make/test_common.h
  test/make/uncaught_exception.h

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: test/lang/c/shared_lib/foo.h
===================================================================
--- test/lang/c/shared_lib/foo.h
+++ test/lang/c/shared_lib/foo.h
@@ -6,7 +6,7 @@
   char *sub_2;
 };
 
-struct foo *GetMeAFoo();
-struct sub_foo *GetMeASubFoo (struct foo *in_foo);
+LLDB_TEST_API struct foo *GetMeAFoo();
+LLDB_TEST_API struct sub_foo *GetMeASubFoo (struct foo *in_foo);
 
 
Index: test/make/Makefile.rules
===================================================================
--- test/make/Makefile.rules
+++ test/make/Makefile.rules
@@ -114,6 +114,7 @@
 
 CFLAGS ?= -g -O0
 CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
+CFLAGS += -include $(THIS_FILE_DIR)test_common.h
 
 # Use this one if you want to build one part of the result without debug information:
 CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS)
@@ -148,6 +149,8 @@
 ifneq "$(DYLIB_NAME)" ""
 	ifeq "$(OS)" "Darwin"
 		DYLIB_FILENAME = lib$(DYLIB_NAME).dylib
+  else ifeq "$(OS)" "Windows_NT"
+    DYLIB_FILENAME = $(DYLIB_NAME).dll
 	else
 		DYLIB_FILENAME = lib$(DYLIB_NAME).so
 	endif
@@ -184,7 +187,6 @@
 	ifneq (,$(findstring clang,$(CC)))
 		# Clang for Windows doesn't support C++ Exceptions
 		CXXFLAGS += -fno-exceptions
-		CXXFLAGS += -include $(THIS_FILE_DIR)uncaught_exception.h
 		CXXFLAGS += -D_HAS_EXCEPTIONS=0
 		# The MSVC linker doesn't understand long section names
 		# generated by the clang compiler.
@@ -373,6 +375,8 @@
 #----------------------------------------------------------------------
 # Make the dylib
 #----------------------------------------------------------------------
+$(DYLIB_OBJECTS) : CFLAGS += -DCOMPILING_LLDB_TEST
+
 $(DYLIB_FILENAME) : $(DYLIB_OBJECTS)
 ifeq "$(OS)" "Darwin"
 	$(LD) $(LDFLAGS) $(DYLIB_OBJECTS) -install_name "@executable_path/$(DYLIB_FILENAME)" -dynamiclib -o "$(DYLIB_FILENAME)"
@@ -391,7 +395,7 @@
 
 #----------------------------------------------------------------------
 # Automatic variables based on items already entered. Below we create
-# an objects lists from the list of sources by replacing all entries
+# an object's lists from the list of sources by replacing all entries
 # that end with .c with .o, and we also create a list of prerequisite
 # files by replacing all .c files with .d.
 #----------------------------------------------------------------------
@@ -405,28 +409,36 @@
 # the compiler -MM option. The -M option will list all system headers,
 # and the -MM option will list all non-system dependencies.
 #----------------------------------------------------------------------
+ifeq "$(OS)" "Windows_NT"
+	SEMICOLON = &
+	QUOTE = "
+else
+	SEMICOLON = ;
+	QUOTE = '
+endif
+
 %.d: %.c
-	@rm -f $@; \
+	@rm -f $@ $(SEMICOLON) \
 	$(CC) -M $(CFLAGS) $< > [email protected] && \
-	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < [email protected] > $@; \
+	sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < [email protected] > $@ $(SEMICOLON) \
 	rm -f [email protected]
 
 %.d: %.cpp
-	@rm -f $@; \
+	@rm -f $@ $(SEMICOLON) \
 	$(CXX) -M $(CXXFLAGS) $< > [email protected] && \
-	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < [email protected] > $@; \
+	sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < [email protected] > $@ $(SEMICOLON) \
 	rm -f [email protected]
 
 %.d: %.m
-	@rm -f $@; \
+	@rm -f $@ $(SEMICOLON) \
 	$(CC) -M $(CFLAGS) $< > [email protected] && \
-	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < [email protected] > $@; \
+	sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < [email protected] > $@ $(SEMICOLON) \
 	rm -f [email protected]
 
 %.d: %.mm
-	@rm -f $@; \
+	@rm -f $@ $(SEMICOLON) \
 	$(CXX) -M $(CXXFLAGS) $< > [email protected] && \
-	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < [email protected] > $@; \
+	sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < [email protected] > $@ $(SEMICOLON) \
 	rm -f [email protected]
 
 #----------------------------------------------------------------------
@@ -457,6 +469,10 @@
 endif
 ifeq "$(OS)" "Windows_NT"
 	$(RM) "$(EXE).manifest" $(wildcard *.pdb *.ilk)
+  ifneq "$(DYLIB_NAME)" ""
+	  $(RM) $(DYLIB_FILENAME).manifest
+	  $(RM) $(DYLIB_NAME).lib $(DYLIB_NAME).exp
+  endif
 endif
 
 #----------------------------------------------------------------------
Index: test/make/test_common.h
===================================================================
--- /dev/null
+++ test/make/test_common.h
@@ -0,0 +1,20 @@
+// This header is included in all the test programs (C and C++) and provides a
+// hook for dealing with platform-specifics.
+#if defined(_WIN32) || defined(_WIN64)
+    #ifdef COMPILING_LLDB_TEST
+      #define LLDB_TEST_API __declspec(dllexport)
+    #else
+      #define LLDB_TEST_API __declspec(dllimport)
+    #endif
+#else
+    #define LLDB_TEST_API
+#endif
+
+
+#if defined(__cplusplus) && defined(_MSC_VER) && (_HAS_EXCEPTIONS==0)
+// MSVC header files have compilation issues when compiling with exceptions disabled.  Notably,
+// this function is compiled out when _HAS_EXCEPTIONS=0, but this function is called from another
+// place even when _HAS_EXCEPTIONS=0.  So we define a dummy implementation as a workaround and
+// force include this header file.
+static void *__uncaught_exception() { return nullptr; }
+#endif
Index: test/make/uncaught_exception.h
===================================================================
--- test/make/uncaught_exception.h
+++ /dev/null
@@ -1,5 +0,0 @@
-// MSVC header files have compilation issues when compiling with exceptions disabled.  Notably,
-// this function is compiled out when _HAS_EXCEPTIONS=0, but this function is called from another
-// place even when _HAS_EXCEPTIONS=0.  So we define a dummy implementation as a workaround and
-// force include this header file.
-static void *__uncaught_exception() { return nullptr; }
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to