From c0ab1c5aa4c172aa9e3e0deec5c2cc19d4f278d1 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sun, 22 Jul 2018 20:41:57 +1000 Subject: (nw) srcclean and some cleanup: * Make more #include guards follow standard format - using MAME_ as the prefix makes it easy to see which ones come from our code in a preprocessor dump, and having both src/devices/machine/foo.h and src/mame/machine/foo.h causes issues anyway * Get #include "emu.h" out of headers - it should only be the first thing in a complilation unit or we get differences in behaviour with PCH on/off * Add out-of-line destructors to some devices - it forces the compiler to instantiate the vtable in a certain location and avoids some non-deterministic compiler behaviours --- src/frontend/mame/language.h | 8 ++++---- src/frontend/mame/luaengine.h | 8 ++++---- src/frontend/mame/mame.h | 8 ++++---- src/frontend/mame/ui/icorender.h | 8 ++++---- src/frontend/mame/ui/slider.h | 26 +++++++++++++------------- src/frontend/mame/ui/sliderchangednotifier.h | 12 +++++------- src/frontend/mame/ui/viewgfx.h | 8 ++++---- 7 files changed, 38 insertions(+), 40 deletions(-) (limited to 'src/frontend') diff --git a/src/frontend/mame/language.h b/src/frontend/mame/language.h index 2a9d934576b..73adbb88269 100644 --- a/src/frontend/mame/language.h +++ b/src/frontend/mame/language.h @@ -7,15 +7,15 @@ Multi-language support. ***************************************************************************/ +#ifndef MAME_FRONTEND_MAME_LANGUAGE_H +#define MAME_FRONTEND_MAME_LANGUAGE_H + #pragma once #ifndef __EMU_H__ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __LANGUAGE_H__ -#define __LANGUAGE_H__ - //************************************************************************** // LOCALIZATION SUPPORT //************************************************************************** @@ -28,4 +28,4 @@ void load_translation(emu_options &option); const char *lang_translate(const char *word); -#endif /*__LANGUAGE_H__*/ +#endif // MAME_FRONTEND_MAME_LANGUAGE_H diff --git a/src/frontend/mame/luaengine.h b/src/frontend/mame/luaengine.h index 205c84f2e36..c8189f82083 100644 --- a/src/frontend/mame/luaengine.h +++ b/src/frontend/mame/luaengine.h @@ -8,15 +8,15 @@ ***************************************************************************/ +#ifndef MAME_FRONTEND_MAME_LUAENGINE_H +#define MAME_FRONTEND_MAME_LUAENGINE_H + #pragma once #ifndef __EMU_H__ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __LUA_ENGINE_H__ -#define __LUA_ENGINE_H__ - #if defined(__GNUC__) && (__GNUC__ > 6) #pragma GCC diagnostic ignored "-Wnoexcept-type" #endif @@ -168,4 +168,4 @@ private: }; }; -#endif /* __LUA_ENGINE_H__ */ +#endif // MAME_FRONTEND_MAME_LUAENGINE_H diff --git a/src/frontend/mame/mame.h b/src/frontend/mame/mame.h index 849711cf3a5..3700aaab81b 100644 --- a/src/frontend/mame/mame.h +++ b/src/frontend/mame/mame.h @@ -7,10 +7,10 @@ Controls execution of the core MAME system. ***************************************************************************/ -#pragma once +#ifndef MAME_FRONTEND_MAME_MAME_H +#define MAME_FRONTEND_MAME_MAME_H -#ifndef __MAME_H__ -#define __MAME_H__ +#pragma once class plugin_options; class osd_interface; @@ -87,4 +87,4 @@ private: extern const char build_version[]; extern const char bare_build_version[]; -#endif /* __MAME_H__ */ +#endif // MAME_FRONTEND_MAME_MAME_H diff --git a/src/frontend/mame/ui/icorender.h b/src/frontend/mame/ui/icorender.h index 864969b616d..17bc5a1d8ea 100644 --- a/src/frontend/mame/ui/icorender.h +++ b/src/frontend/mame/ui/icorender.h @@ -10,10 +10,10 @@ http://vitiy.info/Code/ico.cpp ***************************************************************************/ -#pragma once +#ifndef MAME_FRONTEND_MAME_UI_ICORENDER_H +#define MAME_FRONTEND_MAME_UI_ICORENDER_H -#ifndef __UI_ICORENDER_H__ -#define __UI_ICORENDER_H__ +#pragma once // These next two structs represent how the icon information is stored // in an ICO file. @@ -230,4 +230,4 @@ inline void render_load_ico(bitmap_argb32 &bitmap, emu_file &file, const char *d global_free_array(buffer); } -#endif /* __UI_ICORENDER_H__ */ +#endif // MAME_FRONTEND_MAME_UI_ICORENDER_H diff --git a/src/frontend/mame/ui/slider.h b/src/frontend/mame/ui/slider.h index 7c8a1000961..7785518d093 100644 --- a/src/frontend/mame/ui/slider.h +++ b/src/frontend/mame/ui/slider.h @@ -9,29 +9,29 @@ ***************************************************************************/ +#ifndef MAME_FRONTEND_MAME_UI_SLIDER_H +#define MAME_FRONTEND_MAME_UI_SLIDER_H + #pragma once -#ifndef __UI_SLIDER__ -#define __UI_SLIDER__ +#include "sliderchangednotifier.h" #include -#include "sliderchangednotifier.h" - #define SLIDER_NOCHANGE 0x12345678 -typedef std::function slider_update; +typedef std::function slider_update; struct slider_state { - slider_update update; /* callback */ - void * arg; /* argument */ - int32_t minval; /* minimum value */ - int32_t defval; /* default value */ - int32_t maxval; /* maximum value */ - int32_t incval; /* increment value */ + slider_update update; // callback + void * arg; // argument + std::int32_t minval; // minimum value + std::int32_t defval; // default value + std::int32_t maxval; // maximum value + std::int32_t incval; // increment value int id; - std::string description; /* textual description */ + std::string description; // textual description }; -#endif // __UI_SLIDER__ +#endif // MAME_FRONTEND_MAME_UI_SLIDER_H diff --git a/src/frontend/mame/ui/sliderchangednotifier.h b/src/frontend/mame/ui/sliderchangednotifier.h index 60bcf9c79fe..eedb39684f3 100644 --- a/src/frontend/mame/ui/sliderchangednotifier.h +++ b/src/frontend/mame/ui/sliderchangednotifier.h @@ -6,16 +6,14 @@ // //====================================================================== -#pragma once +#ifndef MAME_FRONTEND_MAME_UI_SLIDERCHANGEDNOTIFIER_H +#define MAME_FRONTEND_MAME_UI_SLIDERCHANGEDNOTIFIER_H -#ifndef __SLIDER_CHANGED_NOTIFIER__ -#define __SLIDER_CHANGED_NOTIFIER__ +#pragma once #include #include -using int32_t = std::int32_t; - class running_machine; class slider_changed_notifier @@ -23,7 +21,7 @@ class slider_changed_notifier public: virtual ~slider_changed_notifier() { } - virtual int32_t slider_changed(running_machine &machine, void *arg, int id, std::string *str, int32_t newval) = 0; + virtual std::int32_t slider_changed(running_machine &machine, void *arg, int id, std::string *str, std::int32_t newval) = 0; }; -#endif // __SLIDER_CHANGED_NOTIFIER__ +#endif // MAME_FRONTEND_MAME_UI_SLIDERCHANGEDNOTIFIER_H diff --git a/src/frontend/mame/ui/viewgfx.h b/src/frontend/mame/ui/viewgfx.h index 5043ded0a27..a4d2205d7a8 100644 --- a/src/frontend/mame/ui/viewgfx.h +++ b/src/frontend/mame/ui/viewgfx.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_FRONTEND_MAME_UI_VIEWGFX_H +#define MAME_FRONTEND_MAME_UI_VIEWGFX_H -#ifndef __UI_VIEWGFX_H__ -#define __UI_VIEWGFX_H__ +#pragma once @@ -29,4 +29,4 @@ bool ui_gfx_is_relevant(running_machine &machine); uint32_t ui_gfx_ui_handler(render_container &container, mame_ui_manager &mui, bool uistate); -#endif /* __UI_VIEWGFX_H__ */ +#endif // MAME_FRONTEND_MAME_UI_VIEWGFX_H -- cgit v1.2.3