Small code/build cleanup patches

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Small code/build cleanup patches

Bojan Nikolic

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
Reply | Threaded
Open this post in threaded view
|

Re: Small code/build cleanup patches

Luigi Ballabio
Applied, thanks.

Luigi

On Sun, Sep 2, 2012 at 11:53 AM, Bojan Nikolic <[hidden email]> wrote:

>
> 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

------------------------------------------------------------------------------
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