pecos / tps

Torch Plasma Simulator
BSD 3-Clause "New" or "Revised" License
8 stars 2 forks source link

Start to eliminate deprecated code #195

Closed trevilo closed 1 year ago

trevilo commented 1 year ago
Overview

This PR adds a configure flag (--enable-build-deprecated, which is off by default) that defines a preprocessor variable (_BUILD_DEPRECATED_) which can be used to optionally build code that has been marked as deprecated. In addition, a few sections have been marked as deprecated. These are detailed below.

Motivation

tps has significant chunks of code that do not appear to be used or supported anymore. Rather than delete these immediately, I prefer to conditionally "delete" them from the build with #ifdef. This enables testing with and without these sections without requiring them to be actually deleted until we are convinced they will never be useful.

General Usage

To mark a deprecated section, simply surround it as follows:

#ifdef _BUILD_DEPRECATED_
// this code is eliminated from the build
// unless --enable-build-deprecated is passed to configure
#endif

In a standard build _BUILD_DEPRECATED_ is undefined, so this code is not compiled. To include it, simply configure with --enable-build-deprecated.

Deprecated Sections

Three types of code section have been marked with #if _BUILD_DEPRECATED_ in this PR. These sections are as follows:

Unless someone objects, these sections will be removed in the near future.