Skip to content

Commit

Permalink
Miscellaneous hosekeeping.
Browse files Browse the repository at this point in the history
- Update `windows/povconfig/syspovconfig_msvc.h` to detect modern versions of Visual Studio. Also, discard detailed detection of earlier versions we no longer support anyway.
- Move `POV_BOMB_ON_ERROR` compile-time config setting from core to base where it belongs.
- Clean up whitespace in some files.
- Added a few comments.
  • Loading branch information
c-lipka committed Jun 4, 2021
1 parent 110df4f commit 37b99bd
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 87 deletions.
20 changes: 19 additions & 1 deletion source/base/configbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/// @parblock
///
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.8.
/// Copyright 1991-2019 Persistence of Vision Raytracer Pty. Ltd.
/// Copyright 1991-2021 Persistence of Vision Raytracer Pty. Ltd.
///
/// POV-Ray is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -903,6 +903,24 @@
#define POV_STRING_DEBUG POV_DEBUG
#endif

/// @def POV_BOMB_ON_ERROR
/// Fail hard on all errors, allowing a debugger to kick in.
///
/// Define as non-zero integer to enable, or zero to disable.
///
/// If left undefined by system-specific configurations, this setting defaults to `0`.
///
/// @attention
/// This setting is _strictly_ for debugging purposes only. It should _never ever_ be enabled
/// in _any_ builds released to end users, be it release builds or otherwise!
///
/// @note
/// At present, this is not yet supported by all error conditions.
///
#ifndef POV_BOMB_ON_ERROR
#define POV_BOMB_ON_ERROR 0
#endif

/// @}
///
//******************************************************************************
Expand Down
18 changes: 0 additions & 18 deletions source/core/configcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,24 +290,6 @@
///
/// @{

/// @def POV_BOMB_ON_ERROR
/// Fail hard on all errors, allowing a debugger to kick in.
///
/// Define as non-zero integer to enable, or zero to disable.
///
/// If left undefined by system-specific configurations, this setting defaults to `0`.
///
/// @attention
/// This setting is _strictly_ for debugging purposes only, and should _never ever_ be enabled
/// in a release build!
///
/// @note
/// At present, this is not yet supported by all error conditions.
///
#ifndef POV_BOMB_ON_ERROR
#define POV_BOMB_ON_ERROR 0
#endif

/// @def POV_CORE_DEBUG
/// Default setting for enabling or disabling @ref PovCore debugging aids.
///
Expand Down
2 changes: 1 addition & 1 deletion unix/config/ax_check_libjpeg.m4
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ AC_DEFUN([AX_CHECK_LIBJPEG],
[jpeglib.h],
[
# check library version, update LIBS
if test x"$1" != x"$ax_check_libjpeg_version_num"; then
if test x"$1" != x"$ax_check_libjpeg_version_num"; then
AC_MSG_CHECKING([for libjpeg version >= $1 ($ax_check_libjpeg_version_num)])
else
AC_MSG_CHECKING([for libjpeg version >= $1])
Expand Down
2 changes: 1 addition & 1 deletion unix/config/ax_check_openexr.m4
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ AC_DEFUN([AX_CHECK_OPENEXR],
# FIXME: workaround for versions >= 1.4.0
AX_COMPARE_VERSION([$ax_check_openexr_version], [ge], [1.4],
[LIBS="$ax_check_openexr_libs -lIlmThread $LIBS"],
[LIBS="$ax_check_openexr_libs $LIBS"]
[LIBS="$ax_check_openexr_libs $LIBS"]
)
# check include file
Expand Down
5 changes: 4 additions & 1 deletion windows/povconfig/syspovconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/// @parblock
///
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.8.
/// Copyright 1991-2019 Persistence of Vision Raytracer Pty. Ltd.
/// Copyright 1991-2021 Persistence of Vision Raytracer Pty. Ltd.
///
/// POV-Ray is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -117,6 +117,9 @@

namespace povwin
{
// Debugging aids.
// These are not normally called from the POV-Ray code, but are kept around as useful helpers
// during debug sessions.
void WIN_Debug_Log(unsigned int from, const char *msg) ;
void WIN32_DEBUG_OUTPUT(const char *format,...) ;
void WIN32_DEBUG_FILE_OUTPUT(const char *format,...) ;
Expand Down
92 changes: 30 additions & 62 deletions windows/povconfig/syspovconfig_msvc.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/// @parblock
///
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.8.
/// Copyright 1991-2019 Persistence of Vision Raytracer Pty. Ltd.
/// Copyright 1991-2021 Persistence of Vision Raytracer Pty. Ltd.
///
/// POV-Ray is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -93,75 +93,43 @@
#pragma warning(disable : 4305) /* truncation from 'type1' to 'type2' (mostly double to float) */
#pragma warning(disable : 4244) /* possible loss of data (converting ints to shorts) */

#if _MSC_VER >= 1400 && _MSC_VER < 1500 && !defined (_WIN64)
// MS Visual C++ 2005 (aka 8.0), compiling for 32 bit target
#define POV_COMPILER_VER "msvc8"
#define METADATA_COMPILER_STRING "msvc 8"
#define NEED_INVHYP
#define POV_CPP11_SUPPORTED 0
#define POV_CPP14_SUPPORTED 0
#elif _MSC_VER >= 1400 && _MSC_VER < 1500 && defined (_WIN64)
// MS Visual C++ 2005 (aka 8.0), compiling for 64 bit target
#define POV_COMPILER_VER "msvc8"
#define METADATA_COMPILER_STRING "msvc 8"
inline const int& max(const int& _X, const int& _Y) {return (_X < _Y ? _Y : _X); }
inline const int& min(const int& _X, const int& _Y) {return (_Y < _X ? _Y : _X); }
inline const unsigned int& max(const unsigned int& _X, const unsigned int& _Y) {return (_X < _Y ? _Y : _X); }
inline const unsigned int& min(const unsigned int& _X, const unsigned int& _Y) {return (_Y < _X ? _Y : _X); }
inline const long& max(const long& _X, const long& _Y) {return (_X < _Y ? _Y : _X); }
inline const long& min(const long& _X, const long& _Y) {return (_Y < _X ? _Y : _X); }
inline const unsigned long& max(const unsigned long& _X, const unsigned long& _Y) {return (_X < _Y ? _Y : _X); }
inline const unsigned long& min(const unsigned long& _X, const unsigned long& _Y) {return (_Y < _X ? _Y : _X); }
#define NEED_INVHYP
#define POV_CPP11_SUPPORTED 0
#define POV_CPP14_SUPPORTED 0
#elif _MSC_VER >= 1500 && _MSC_VER < 1600
// MS Visual C++ 2008 (aka 9.0)
#define POV_COMPILER_VER "msvc9"
#define METADATA_COMPILER_STRING "msvc 9"
#define NEED_INVHYP
#define POV_CPP11_SUPPORTED 0
#define POV_CPP14_SUPPORTED 0
#elif _MSC_VER >= 1600 && _MSC_VER < 1700
// MS Visual C++ 2010 (aka 10.0)
#define POV_COMPILER_VER "msvc10"
#define METADATA_COMPILER_STRING "msvc 10"
// msvc10 defines std::hash<> as a class, while boost's flyweight_fwd.hpp may forward-declare it as a struct;
// this is valid according to the C++ standard, but causes msvc10 to issue warnings.
#pragma warning(disable : 4099)
#define NEED_INVHYP
#define POV_CPP11_SUPPORTED 0
#define POV_CPP14_SUPPORTED 0
#elif _MSC_VER >= 1700 && _MSC_VER < 1800
// MS Visual C++ 2012 (aka 11.0)
#define POV_COMPILER_VER "msvc11"
#define METADATA_COMPILER_STRING "msvc 11"
#error "Please update syspovconfig_msvc.h to include this version of MSVC"
// The following settings are just guesswork, and have never been tested:
#define NEED_INVHYP
#define POV_CPP11_SUPPORTED 0
#define POV_CPP14_SUPPORTED 0
#elif _MSC_VER >= 1800 && _MSC_VER < 1900
// MS Visual C++ 2013 (aka 12.0)
#define POV_COMPILER_VER "msvc12"
#define METADATA_COMPILER_STRING "msvc 12"
#error "Please update syspovconfig_msvc.h to include this version of MSVC"
// The following settings are just guesswork, and have never been tested:
#define POV_CPP11_SUPPORTED 0
#define POV_CPP14_SUPPORTED 0
// NB: The Microsoft Visual Studio developers seem to have skipped internal version number 13 entirely.
#elif _MSC_VER >= 1900 && _MSC_VER < 2000
#if _MSC_VER < 1900
// Visual C++ 2013 and earlier do not comply with C++11,
// which as of v3.8.0 is a prerequisite for compiling POV-Ray.
#error "This software no longer supports your version of MS Visual C++"
#elif _MSC_VER >= 1900 && _MSC_VER < 1910
// MS Visual C++ 2015 (aka 14.0)
#define POV_COMPILER_VER "msvc14"
#define METADATA_COMPILER_STRING "msvc 14"
#define METADATA_COMPILER_STRING "msvc 14.0"
// Visual C++ 2015 defines `__cplusplus` as `199711L` (C++98),
// but supports all the C++11 features we need
#define POV_CPP11_SUPPORTED 1
#define POV_CPP14_SUPPORTED 1
#ifndef DEBUG
// Suppress erroneous warning about `string` having different alignment in base and parser.
#pragma warning(disable : 4742) // 'var' has different alignment in 'file1' and 'file2': number and number
#endif
#elif _MSC_VER >= 1910 && _MSC_VER < 1920
// MS Visual C++ 2017 (aka 14.1x)
#define POV_COMPILER_VER "msvc141"
#define METADATA_COMPILER_STRING "msvc 14.1x"
// Visual C++ 2017 15.6 (and earlier) defines `__cplusplus` as `199711L` (C++98),
// but supports all the C++11 features we need (and also pretty much all of C++14)
#define POV_CPP11_SUPPORTED 1
#define POV_CPP14_SUPPORTED 1
// TODO - This compiler version has been tested, but no effort has been made yet
// to iron out any inconveniences such as unwarranted warnings or the like.
#elif _MSC_VER >= 1920 && _MSC_VER < 1930
// MS Visual C++ 2019 (aka 14.2x)
#define POV_COMPILER_VER "msvc142"
#define METADATA_COMPILER_STRING "msvc 14.2x"
// (no need to set `POV_*_SUPPORTED for VS 2019 and later, we can probe `__cplusplus`)
// TODO - This compiler version has been tested, but no effort has been made yet
// to iron out any inconveniences such as unwarranted warnings or the like.
#else
#error "Please update syspovconfig_msvc.h to include this version of MSVC"
// Unrecognized version of MS Visual C++
#error("Your version of MS Visual C++ is still unknown to us. Proceed at your own risk.")
#define POV_COMPILER_VER "msvc"
#define METADATA_COMPILER_STRING "msvc"
#endif
#define COMPILER_NAME "Microsoft Visual C++"
#define COMPILER_VERSION _MSC_VER
Expand Down
3 changes: 2 additions & 1 deletion windows/pvedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/// @parblock
///
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.8.
/// Copyright 1991-2019 Persistence of Vision Raytracer Pty. Ltd.
/// Copyright 1991-2021 Persistence of Vision Raytracer Pty. Ltd.
///
/// POV-Ray is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -259,6 +259,7 @@ bool LoadEditorDLL (char *path, bool errorOK)
return (true) ;
}

// TODO FIXME - This is almost identical to Parser::Get_Reserved_Words() in parser/parser_tokenizer.cpp.
char *Get_Reserved_Words (const char *additional_words)
{
int length = 0 ;
Expand Down
4 changes: 2 additions & 2 deletions windows/pvengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/// @parblock
///
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.8.
/// Copyright 1991-2019 Persistence of Vision Raytracer Pty. Ltd.
/// Copyright 1991-2021 Persistence of Vision Raytracer Pty. Ltd.
///
/// POV-Ray is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -375,7 +375,7 @@ CRITICAL_SECTION critical_section ;
// key is the name of an included file (all lower case).
// content is the name of the most recent rendered file that caused it to be included.
map<std::string, std::string> IncludeToSourceMap;
map<std::string, bool> IncludeAlternateDecisionMap;
map<std::string, bool> IncludeAlternateDecisionMap;

char queued_files [MAX_QUEUE] [_MAX_PATH] ;
char dir [_MAX_PATH] ;
Expand Down

0 comments on commit 37b99bd

Please sign in to comment.