Login  Register

Small code/build cleanup patches

Posted by Bojan Nikolic on Sep 02, 2012; 9:53am
URL: http://quantlib.414.s1.nabble.com/Small-code-build-cleanup-patches-tp13129.html


Hi Luigi et al,

Here are some very small cleanup patches I had to apply to get the build
work satisfactorily with mingw32 4.2.1 and boost 1.50:

- Boost v1.50 seems to need an assertion_failed function version which
  also takes a message:

--- a/QuantLib/ql/errors.cpp                                                    
+++ b/QuantLib/ql/errors.cpp                                                    
@@ -81,6 +81,16 @@
 namespace boost {                                                              
                                                                               
     // must be defined by the user                                            
+    void assertion_failed_msg(char const * expr, char const * function,        
+                              char const * file, char const *mm, long line) {  
+        throw std::runtime_error(format(file, line, function,                  
+                                        "Boost assertion failed: " +          
+                                        std::string(expr)+                    
+                                        " with message: "+                    
+                                        std::string(mm)));                    
+    }                                                                          
+                                                                              
+    // must be defined by the user                                            
     void assertion_failed(char const * expr, char const * function,            
                           char const * file, long line) {                      
         throw std::runtime_error(format(file, line, function,                  


- GammaFunction class does not have a user-specified default
  constructor, so const instances needs to be explicitly
  default-constructed

--- a/QuantLib/ql/pricingengines/vanilla/analytich1hwengine.cpp                
+++ b/QuantLib/ql/pricingengines/vanilla/analytich1hwengine.cpp                
@@ -81,7 +81,7 @@
     }                                                                          
                                                                               
     Real AnalyticH1HWEngine::Fj_Helper::Lambda(Time t) const {                
-        const GammaFunction g;                                                
+        const GammaFunction g=GammaFunction();                                
         const Size maxIter = 1000;                                            
         const Real lambdaT = lambda(t);                                        


- Libraries to link against should ideally go in LDADD postfix variables

--- a/QuantLib/test-suite/Makefile.am                                          
+++ b/QuantLib/test-suite/Makefile.am                                          
@@ -179,12 +179,12 @@
 endif                                                                          
                                                                               
 quantlib_test_suite_SOURCES = ${QL_TESTS}                                      
-quantlib_test_suite_LDADD = libUnitMain.la ${top_builddir}/ql/libQuantLib.la  
-quantlib_test_suite_LDFLAGS = -l${BOOST_UNIT_TEST_LIB}                        
+quantlib_test_suite_LDADD = libUnitMain.la ${top_builddir}/ql/libQuantLib.la -\
l${BOOST_UNIT_TEST_LIB}                                                        
+quantlib_test_suite_LDFLAGS =                                                  
                                                                               
 quantlib_benchmark_SOURCES = ${QL_BENCHMARKS}                                  
-quantlib_benchmark_LDADD = libUnitMain.la ${top_builddir}/ql/libQuantLib.la    
-quantlib_benchmark_LDFLAGS = -l${BOOST_UNIT_TEST_LIB}                          
+quantlib_benchmark_LDADD = libUnitMain.la ${top_builddir}/ql/libQuantLib.la -l\
${BOOST_UNIT_TEST_LIB}                                                          
+quantlib_benchmark_LDFLAGS =                                                  
                                                                               
 TESTS = quantlib-test-suite$(EXEEXT)                                          
 TESTS_ENVIRONMENT = BOOST_TEST_LOG_LEVEL=message                              


--
Bojan Nikolic          ||          http://www.bnikolic.co.uk

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev