From fad4210f7bb0369b1dd827dc0a1a072f5ea5b75d Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 4 Jun 2020 01:24:49 -0700 Subject: [PATCH] Various files: simplify #includes. On Windows, include boinc_win.h No references to STDWX_H, STDAFX_H etc. Note: .cpp files should not have a bunch of gnarly #if logic in their includes. If such logic is needed, put it in a central place. --- api/boinc_api.cpp | 5 +---- api/boinc_opencl.cpp | 5 +---- api/graphics2_win.cpp | 2 +- api/graphics_api.cpp | 2 +- api/graphics_impl.cpp | 10 ++-------- api/gutil.cpp | 2 +- api/gutil_text.cpp | 2 +- api/reduce_lib.cpp | 7 ++----- api/reduce_main.cpp | 2 +- api/ttfont.cpp | 2 +- api/windows_opengl.cpp | 2 +- client/hostinfo_win.cpp | 2 +- clientctrl/boincsvcctrl.cpp | 2 +- clientgui/browser.cpp | 5 +---- lib/cert_sig.cpp | 8 +------- lib/diagnostics_win.cpp | 6 ------ lib/run_app_windows.cpp | 4 ---- 17 files changed, 17 insertions(+), 51 deletions(-) diff --git a/api/boinc_api.cpp b/api/boinc_api.cpp index fb041c07b0..fdd3eb7599 100644 --- a/api/boinc_api.cpp +++ b/api/boinc_api.cpp @@ -82,11 +82,8 @@ // (not counting the part after the last checkpoint in an episode). -#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) -#include "boinc_win.h" -#endif - #ifdef _WIN32 +#include "boinc_win.h" #include "version.h" #include "win_util.h" #else diff --git a/api/boinc_opencl.cpp b/api/boinc_opencl.cpp index 908bdf8b4c..f31b73d094 100644 --- a/api/boinc_opencl.cpp +++ b/api/boinc_opencl.cpp @@ -24,11 +24,8 @@ // To use this function, link your application with libboinc_opencl.a // -#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) -#include "boinc_win.h" -#endif - #ifdef _WIN32 +#include "boinc_win.h" #include "win_util.h" #else #include diff --git a/api/graphics2_win.cpp b/api/graphics2_win.cpp index 4f544d716d..2c748b0a13 100644 --- a/api/graphics2_win.cpp +++ b/api/graphics2_win.cpp @@ -20,7 +20,7 @@ // Platform-independent code should NOT be here. // -#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) +#ifdef _WIN32 #include "boinc_win.h" #else #include "config.h" diff --git a/api/graphics_api.cpp b/api/graphics_api.cpp index d9c509ab68..0e1380892e 100644 --- a/api/graphics_api.cpp +++ b/api/graphics_api.cpp @@ -17,7 +17,7 @@ // DEPRECATED - DO NOT USE -#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) +#ifdef _WIN32 #include "boinc_win.h" #else #include "config.h" diff --git a/api/graphics_impl.cpp b/api/graphics_impl.cpp index 4e056d6613..af6236f078 100644 --- a/api/graphics_impl.cpp +++ b/api/graphics_impl.cpp @@ -23,17 +23,11 @@ // DEPRECATED - use separate graphics app -#ifndef _WIN32 -#include "config.h" -#endif - -#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) -#include "boinc_win.h" -#endif - #ifdef _WIN32 +#include "boinc_win.h" extern void win_graphics_event_loop(); #else +#include "config.h" #include #include #include diff --git a/api/gutil.cpp b/api/gutil.cpp index a0b4346d19..6cd12099a5 100644 --- a/api/gutil.cpp +++ b/api/gutil.cpp @@ -15,7 +15,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see . -#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) +#ifdef _WIN32 #include "boinc_win.h" #else #include "config.h" diff --git a/api/gutil_text.cpp b/api/gutil_text.cpp index 58ce685162..a6483ed593 100644 --- a/api/gutil_text.cpp +++ b/api/gutil_text.cpp @@ -17,7 +17,7 @@ // The part of BOINC's graphics utilities that uses GLUT char-drawing -#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) +#ifdef _WIN32 #include "boinc_win.h" #else #include "config.h" diff --git a/api/reduce_lib.cpp b/api/reduce_lib.cpp index efb84bfa95..620f8ea856 100644 --- a/api/reduce_lib.cpp +++ b/api/reduce_lib.cpp @@ -17,16 +17,13 @@ // shared-library part of the implementation of REDUCE -#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) +#ifdef _WIN32 #include "boinc_win.h" +#include #else #include "config.h" #endif -#ifdef _WIN32 -#include -#endif - #include #include "boinc_gl.h" diff --git a/api/reduce_main.cpp b/api/reduce_main.cpp index 9f474c3379..0e63c4f160 100644 --- a/api/reduce_main.cpp +++ b/api/reduce_main.cpp @@ -20,7 +20,7 @@ // This writes into a shared-memory structure // that's read by the graphics app -#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) +#ifdef _WIN32 #include "boinc_win.h" #else #include "config.h" diff --git a/api/ttfont.cpp b/api/ttfont.cpp index 5dbcd017fb..eb99b328d8 100644 --- a/api/ttfont.cpp +++ b/api/ttfont.cpp @@ -31,7 +31,7 @@ // originally adapted by Carl Christensen -#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) +#ifdef _WIN32 #include "boinc_win.h" #endif diff --git a/api/windows_opengl.cpp b/api/windows_opengl.cpp index af9252cd3e..baf69da01e 100644 --- a/api/windows_opengl.cpp +++ b/api/windows_opengl.cpp @@ -12,7 +12,7 @@ * Visit My Site At nehe.gamedev.net * Adapted to BOINC by Eric Heien */ -#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) +#ifdef _WIN32 #include "boinc_win.h" #else #include "config.h" diff --git a/client/hostinfo_win.cpp b/client/hostinfo_win.cpp index d1369781ed..262f84df10 100644 --- a/client/hostinfo_win.cpp +++ b/client/hostinfo_win.cpp @@ -15,7 +15,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see . -#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) +#ifdef _WIN32 #include "boinc_win.h" #endif diff --git a/clientctrl/boincsvcctrl.cpp b/clientctrl/boincsvcctrl.cpp index 72151bfbf6..0a8fd9a466 100644 --- a/clientctrl/boincsvcctrl.cpp +++ b/clientctrl/boincsvcctrl.cpp @@ -15,7 +15,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see . -#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) +#ifdef _WIN32 #include "boinc_win.h" #endif diff --git a/clientgui/browser.cpp b/clientgui/browser.cpp index a0bfe84bbd..41081d0bf7 100644 --- a/clientgui/browser.cpp +++ b/clientgui/browser.cpp @@ -16,11 +16,8 @@ // along with BOINC. If not, see . -#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) -#include "boinc_win.h" -#endif - #ifdef _WIN32 +#include "boinc_win.h" #include "win_util.h" #ifndef InternetGetCookie diff --git a/lib/cert_sig.cpp b/lib/cert_sig.cpp index fadde5d7be..f4afc445cf 100644 --- a/lib/cert_sig.cpp +++ b/lib/cert_sig.cpp @@ -15,10 +15,8 @@ // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see . -#if defined(_WIN32) && !defined(__STDWX_H__) +#ifdef _WIN32 #include "boinc_win.h" -#elif defined(_WIN32) && defined(__STDWX_H__) -#include "stdwx.h" #else #include "config.h" #ifdef _USING_FCGI_ @@ -33,10 +31,6 @@ #include "cert_sig.h" -#ifdef _MSC_VER -#define snprintf _snprintf -#endif - CERT_SIG::CERT_SIG() { this->clear(); } diff --git a/lib/diagnostics_win.cpp b/lib/diagnostics_win.cpp index 38fc15d34b..5784e5d697 100644 --- a/lib/diagnostics_win.cpp +++ b/lib/diagnostics_win.cpp @@ -18,14 +18,8 @@ // Stuff related to catching SEH exceptions, monitoring threads, and trapping // debugger messages; used by both core client and by apps. -#ifdef _WIN32 -#ifndef __STDWX_H__ #include "boinc_win.h" -#else -#include "stdwx.h" -#endif #include "win_util.h" -#endif #ifndef __CYGWIN32__ #include "stackwalker_win.h" diff --git a/lib/run_app_windows.cpp b/lib/run_app_windows.cpp index 136b03acc8..f0958c9973 100644 --- a/lib/run_app_windows.cpp +++ b/lib/run_app_windows.cpp @@ -18,11 +18,7 @@ // Code to run a BOINC application (main or graphics) under Windows // Don't include this in applications -#if defined(_WIN32) && !defined(__STDWX_H__) #include "boinc_win.h" -#elif defined(_WIN32) && defined(__STDWX_H__) -#include "stdwx.h" -#endif #include "win_util.h" #include "filesys.h"