diff --git a/CMakeLists.txt b/CMakeLists.txt index 26b94d8..90f145b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,15 @@ project(Tyro) include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include) +# C11, please +include(CheckCCompilerFlag) +CHECK_C_COMPILER_FLAG("-std=c11" COMPILER_SUPPORTS_C11) +if (COMPILER_SUPPORTS_C11) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") +else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") +endif() + # C++11, please include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) diff --git a/sonar-project.properties b/sonar-project.properties index e947eac..15684da 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,5 +1,5 @@ sonar.projectKey=tyro -sonar.projectName=tyro +sonar.projectName=Tyro sonar.projectVersion=1.0.0 sonar.sources=src sonar.language=c++ diff --git a/src/base/SFTP.h b/src/base/SFTP.h index 570c863..76b2e0a 100644 --- a/src/base/SFTP.h +++ b/src/base/SFTP.h @@ -5,8 +5,7 @@ * Created on April 6, 2015, 2:22 PM */ -#ifndef SFTP_H -#define SFTP_H +#pragma once #include "../common.h" @@ -52,6 +51,3 @@ private: void ssh_connect(); void sftp_connect(); }; - -#endif /* SFTP_H */ - diff --git a/src/common.h b/src/common.h index ecf8440..addd433 100644 --- a/src/common.h +++ b/src/common.h @@ -1,8 +1,7 @@ /** * A common header for global includes */ -#ifndef TYRO_COMMON_H -#define TYRO_COMMON_H +#pragma once // C++ Standard Lib includes #include @@ -25,7 +24,4 @@ typedef Json::Writer JsonWriter; // Typedef some common templates typedef map StringConstMap; typedef map StringMap; -typedef vector StringVector; - -#endif // TYRO_COMMON_H - +typedef vector StringVector; \ No newline at end of file diff --git a/src/definitions.h b/src/definitions.h index 54fd802..88f6b0e 100644 --- a/src/definitions.h +++ b/src/definitions.h @@ -1,9 +1,7 @@ /** * Miscellaneous Program-specific definitions */ - -#ifndef DEFINITIONS_H -#define DEFINITIONS_H +#pragma once // Application config const wxString APP_NAME = "Tyro"; @@ -136,7 +134,4 @@ const wxString TYRO_FILE_SAVE_WILDCARDS = "Shell (*.sh, *.bsh)|*.sh;*.bsh|" "SQL (*.sql)|*.sql|" "Text (*.txt)|*.txt|" - "Yaml (.yml,*.yaml)| *.yml;*.yaml"; - -#endif /* DEFINITIONS_H */ - + "Yaml (.yml,*.yaml)| *.yml;*.yaml"; \ No newline at end of file diff --git a/src/settings/Config.h b/src/settings/Config.h index 18d6c74..e0c0083 100644 --- a/src/settings/Config.h +++ b/src/settings/Config.h @@ -1,5 +1,4 @@ -#ifndef TYRO_CONFIG_H -#define TYRO_CONFIG_H +#pragma once #include "src/common.h" @@ -13,7 +12,3 @@ private: JsonValue default_root; JsonReader reader; }; - - -#endif /* TYRO_CONFIG_H */ - diff --git a/src/settings/LangConfig.h b/src/settings/LangConfig.h index 36428d9..a73ca4f 100644 --- a/src/settings/LangConfig.h +++ b/src/settings/LangConfig.h @@ -1,5 +1,4 @@ -#ifndef TYRO_LANG_CONFIG_H -#define TYRO_LANG_CONFIG_H +#pragma once #include "src/wx_common.h" #include "src/settings/Config.h" @@ -20,5 +19,3 @@ private: string lang; StringMap reverseMap; }; - -#endif diff --git a/src/settings/ThemeConfig.h b/src/settings/ThemeConfig.h index 644cbc4..2e8d759 100644 --- a/src/settings/ThemeConfig.h +++ b/src/settings/ThemeConfig.h @@ -1,9 +1,7 @@ /** * Theme manager */ - -#ifndef TYRO_THEME_CONFIG_H -#define TYRO_THEME_CONFIG_H +#pragma once #include "src/wx_common.h" #include "src/settings/Config.h" @@ -20,5 +18,3 @@ private: JsonValue current_theme; }; -#endif /* TYRO_THEME_CONFIG_H */ - diff --git a/src/widgets/EditPane.h b/src/widgets/EditPane.h index 9e71248..7cd64af 100644 --- a/src/widgets/EditPane.h +++ b/src/widgets/EditPane.h @@ -1,6 +1,4 @@ -#ifndef TYROEDIT_PANE_H -#define TYROEDIT_PANE_H - +#pragma once #include "src/widgets/widget.h" #include "src/settings/LangConfig.h" #include "src/settings/ThemeConfig.h" @@ -36,5 +34,3 @@ protected: void SetTheme(string theme_name); void _ApplyTheme(JsonValue &lexer_map); }; - -#endif // TYRODOC_FRAME_H diff --git a/src/widgets/FilePane.cpp b/src/widgets/FilePane.cpp index 1050706..5f1727a 100644 --- a/src/widgets/FilePane.cpp +++ b/src/widgets/FilePane.cpp @@ -70,11 +70,6 @@ void FilePane::CreateTree(const wxString &path, wxTreeListItem &root) for (wxString filename : *files) { wxFileName fname(filename); - - /*if (fname.IsRelative()) - { - fname.MakeAbsolute(); - }*/ // For loose files, just add directly to the tree if (fname.GetDirCount() == 1) diff --git a/src/widgets/FilePane.h b/src/widgets/FilePane.h index 64210af..e82a169 100644 --- a/src/widgets/FilePane.h +++ b/src/widgets/FilePane.h @@ -1,5 +1,4 @@ -#ifndef TYRO_FILE_PANE_H -#define TYRO_FILE_PANE_H +#pragma once #include "src/widgets/widget.h" @@ -23,5 +22,3 @@ private: void CreateTree(const wxString &path, wxTreeListItem &root); }; -#endif /* TYRO_FILE_PANE_H */ - diff --git a/src/widgets/MainFrame.h b/src/widgets/MainFrame.h index 5e820c9..960e334 100644 --- a/src/widgets/MainFrame.h +++ b/src/widgets/MainFrame.h @@ -1,9 +1,7 @@ /** * Main Application Frame */ - -#ifndef TYROMAIN_H -#define TYROMAIN_H +#pragma once #include "src/widgets/TyroMenu.h" #include "src/widgets/EditPane.h" @@ -55,6 +53,3 @@ class MainFrame: public wxFrame void OnQuit(wxCommandEvent &event); void OnAbout(wxCommandEvent &event); }; - - -#endif // TYROMAIN_H diff --git a/src/widgets/PrefPane.h b/src/widgets/PrefPane.h index cd4d244..0179d7f 100644 --- a/src/widgets/PrefPane.h +++ b/src/widgets/PrefPane.h @@ -1,9 +1,7 @@ /** * Preference Panes */ - -#ifndef TYRO_PREF_PANE_H -#define TYRO_PREF_PANE_H +#pragma once #include "src/widgets/widget.h" @@ -17,5 +15,3 @@ protected: wxPreferencesEditor *pref_window = nullptr; }; -#endif /* TYRO_PREF_PANE_H */ - diff --git a/src/widgets/TabContainer.h b/src/widgets/TabContainer.h index f0f0f20..e02aae0 100644 --- a/src/widgets/TabContainer.h +++ b/src/widgets/TabContainer.h @@ -1,9 +1,7 @@ /** * Wrapper around wxAuiNotebook */ - -#ifndef TABCONTAINER_H -#define TABCONTAINER_H +#pragma once #include "src/widgets/TyroMenu.h" #include "src/widgets/EditPane.h" @@ -37,5 +35,3 @@ private: void OnTabContextMenu(wxAuiNotebookEvent &event); }; -#endif /* TABCONTAINER_H */ - diff --git a/src/widgets/TyroMenu.h b/src/widgets/TyroMenu.h index 5f18125..5ac648f 100644 --- a/src/widgets/TyroMenu.h +++ b/src/widgets/TyroMenu.h @@ -1,8 +1,7 @@ /** * Main Menu class */ -#ifndef TYRO_MENU_H -#define TYRO_MENU_H +#pragma once #include "src/widgets/widget.h" @@ -22,7 +21,4 @@ private: void SetupMainMenus(); void SetupLangMenu(); void EnableEntireMenu(size_t menuId, wxMenu *menu, bool enable); -}; - -#endif /* TYRO_MENU_H */ - +}; \ No newline at end of file diff --git a/src/widgets/widget.h b/src/widgets/widget.h index 408e58e..76f7133 100644 --- a/src/widgets/widget.h +++ b/src/widgets/widget.h @@ -1,8 +1,7 @@ /** * Common header for widgets */ -#ifndef TYRO_WIDGET_H -#define TYRO_WIDGET_H +#pragma once // Common wxWidgets stuff #include "src/wx_common.h" @@ -18,6 +17,3 @@ #include #include - -#endif /* TYRO_WIDGET_H */ - diff --git a/src/wx_common.h b/src/wx_common.h index a69eb10..111ac8e 100644 --- a/src/wx_common.h +++ b/src/wx_common.h @@ -1,9 +1,7 @@ /** * Common header for widget classes */ - -#ifndef WX_COMMON_H -#define WX_COMMON_H +#pragma once #include "common.h" @@ -53,7 +51,4 @@ static inline bool HAS_FONT_BUG() } // Tyro-specific variables -#include "definitions.h" - -#endif /* WX_COMMON_H */ - +#include "definitions.h" \ No newline at end of file