Check for C11, use pragma once

This commit is contained in:
Tim Warren 2016-01-13 09:29:09 -05:00
parent a7ecaccc88
commit ab0c586b25
17 changed files with 28 additions and 82 deletions

View File

@ -9,6 +9,15 @@ project(Tyro)
include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include) 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 # C++11, please
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)

View File

@ -1,5 +1,5 @@
sonar.projectKey=tyro sonar.projectKey=tyro
sonar.projectName=tyro sonar.projectName=Tyro
sonar.projectVersion=1.0.0 sonar.projectVersion=1.0.0
sonar.sources=src sonar.sources=src
sonar.language=c++ sonar.language=c++

View File

@ -5,8 +5,7 @@
* Created on April 6, 2015, 2:22 PM * Created on April 6, 2015, 2:22 PM
*/ */
#ifndef SFTP_H #pragma once
#define SFTP_H
#include "../common.h" #include "../common.h"
@ -52,6 +51,3 @@ private:
void ssh_connect(); void ssh_connect();
void sftp_connect(); void sftp_connect();
}; };
#endif /* SFTP_H */

View File

@ -1,8 +1,7 @@
/** /**
* A common header for global includes * A common header for global includes
*/ */
#ifndef TYRO_COMMON_H #pragma once
#define TYRO_COMMON_H
// C++ Standard Lib includes // C++ Standard Lib includes
#include <iostream> #include <iostream>
@ -25,7 +24,4 @@ typedef Json::Writer JsonWriter;
// Typedef some common templates // Typedef some common templates
typedef map<string, int> StringConstMap; typedef map<string, int> StringConstMap;
typedef map<string, string> StringMap; typedef map<string, string> StringMap;
typedef vector<string> StringVector; typedef vector<string> StringVector;
#endif // TYRO_COMMON_H

View File

@ -1,9 +1,7 @@
/** /**
* Miscellaneous Program-specific definitions * Miscellaneous Program-specific definitions
*/ */
#pragma once
#ifndef DEFINITIONS_H
#define DEFINITIONS_H
// Application config // Application config
const wxString APP_NAME = "Tyro"; const wxString APP_NAME = "Tyro";
@ -136,7 +134,4 @@ const wxString TYRO_FILE_SAVE_WILDCARDS =
"Shell (*.sh, *.bsh)|*.sh;*.bsh|" "Shell (*.sh, *.bsh)|*.sh;*.bsh|"
"SQL (*.sql)|*.sql|" "SQL (*.sql)|*.sql|"
"Text (*.txt)|*.txt|" "Text (*.txt)|*.txt|"
"Yaml (.yml,*.yaml)| *.yml;*.yaml"; "Yaml (.yml,*.yaml)| *.yml;*.yaml";
#endif /* DEFINITIONS_H */

View File

@ -1,5 +1,4 @@
#ifndef TYRO_CONFIG_H #pragma once
#define TYRO_CONFIG_H
#include "src/common.h" #include "src/common.h"
@ -13,7 +12,3 @@ private:
JsonValue default_root; JsonValue default_root;
JsonReader reader; JsonReader reader;
}; };
#endif /* TYRO_CONFIG_H */

View File

@ -1,5 +1,4 @@
#ifndef TYRO_LANG_CONFIG_H #pragma once
#define TYRO_LANG_CONFIG_H
#include "src/wx_common.h" #include "src/wx_common.h"
#include "src/settings/Config.h" #include "src/settings/Config.h"
@ -20,5 +19,3 @@ private:
string lang; string lang;
StringMap reverseMap; StringMap reverseMap;
}; };
#endif

View File

@ -1,9 +1,7 @@
/** /**
* Theme manager * Theme manager
*/ */
#pragma once
#ifndef TYRO_THEME_CONFIG_H
#define TYRO_THEME_CONFIG_H
#include "src/wx_common.h" #include "src/wx_common.h"
#include "src/settings/Config.h" #include "src/settings/Config.h"
@ -20,5 +18,3 @@ private:
JsonValue current_theme; JsonValue current_theme;
}; };
#endif /* TYRO_THEME_CONFIG_H */

View File

@ -1,6 +1,4 @@
#ifndef TYROEDIT_PANE_H #pragma once
#define TYROEDIT_PANE_H
#include "src/widgets/widget.h" #include "src/widgets/widget.h"
#include "src/settings/LangConfig.h" #include "src/settings/LangConfig.h"
#include "src/settings/ThemeConfig.h" #include "src/settings/ThemeConfig.h"
@ -36,5 +34,3 @@ protected:
void SetTheme(string theme_name); void SetTheme(string theme_name);
void _ApplyTheme(JsonValue &lexer_map); void _ApplyTheme(JsonValue &lexer_map);
}; };
#endif // TYRODOC_FRAME_H

View File

@ -70,11 +70,6 @@ void FilePane::CreateTree(const wxString &path, wxTreeListItem &root)
for (wxString filename : *files) for (wxString filename : *files)
{ {
wxFileName fname(filename); wxFileName fname(filename);
/*if (fname.IsRelative())
{
fname.MakeAbsolute();
}*/
// For loose files, just add directly to the tree // For loose files, just add directly to the tree
if (fname.GetDirCount() == 1) if (fname.GetDirCount() == 1)

View File

@ -1,5 +1,4 @@
#ifndef TYRO_FILE_PANE_H #pragma once
#define TYRO_FILE_PANE_H
#include "src/widgets/widget.h" #include "src/widgets/widget.h"
@ -23,5 +22,3 @@ private:
void CreateTree(const wxString &path, wxTreeListItem &root); void CreateTree(const wxString &path, wxTreeListItem &root);
}; };
#endif /* TYRO_FILE_PANE_H */

View File

@ -1,9 +1,7 @@
/** /**
* Main Application Frame * Main Application Frame
*/ */
#pragma once
#ifndef TYROMAIN_H
#define TYROMAIN_H
#include "src/widgets/TyroMenu.h" #include "src/widgets/TyroMenu.h"
#include "src/widgets/EditPane.h" #include "src/widgets/EditPane.h"
@ -55,6 +53,3 @@ class MainFrame: public wxFrame
void OnQuit(wxCommandEvent &event); void OnQuit(wxCommandEvent &event);
void OnAbout(wxCommandEvent &event); void OnAbout(wxCommandEvent &event);
}; };
#endif // TYROMAIN_H

View File

@ -1,9 +1,7 @@
/** /**
* Preference Panes * Preference Panes
*/ */
#pragma once
#ifndef TYRO_PREF_PANE_H
#define TYRO_PREF_PANE_H
#include "src/widgets/widget.h" #include "src/widgets/widget.h"
@ -17,5 +15,3 @@ protected:
wxPreferencesEditor *pref_window = nullptr; wxPreferencesEditor *pref_window = nullptr;
}; };
#endif /* TYRO_PREF_PANE_H */

View File

@ -1,9 +1,7 @@
/** /**
* Wrapper around wxAuiNotebook * Wrapper around wxAuiNotebook
*/ */
#pragma once
#ifndef TABCONTAINER_H
#define TABCONTAINER_H
#include "src/widgets/TyroMenu.h" #include "src/widgets/TyroMenu.h"
#include "src/widgets/EditPane.h" #include "src/widgets/EditPane.h"
@ -37,5 +35,3 @@ private:
void OnTabContextMenu(wxAuiNotebookEvent &event); void OnTabContextMenu(wxAuiNotebookEvent &event);
}; };
#endif /* TABCONTAINER_H */

View File

@ -1,8 +1,7 @@
/** /**
* Main Menu class * Main Menu class
*/ */
#ifndef TYRO_MENU_H #pragma once
#define TYRO_MENU_H
#include "src/widgets/widget.h" #include "src/widgets/widget.h"
@ -22,7 +21,4 @@ private:
void SetupMainMenus(); void SetupMainMenus();
void SetupLangMenu(); void SetupLangMenu();
void EnableEntireMenu(size_t menuId, wxMenu *menu, bool enable); void EnableEntireMenu(size_t menuId, wxMenu *menu, bool enable);
}; };
#endif /* TYRO_MENU_H */

View File

@ -1,8 +1,7 @@
/** /**
* Common header for widgets * Common header for widgets
*/ */
#ifndef TYRO_WIDGET_H #pragma once
#define TYRO_WIDGET_H
// Common wxWidgets stuff // Common wxWidgets stuff
#include "src/wx_common.h" #include "src/wx_common.h"
@ -18,6 +17,3 @@
#include <wx/treelist.h> #include <wx/treelist.h>
#include <wx/preferences.h> #include <wx/preferences.h>
#endif /* TYRO_WIDGET_H */

View File

@ -1,9 +1,7 @@
/** /**
* Common header for widget classes * Common header for widget classes
*/ */
#pragma once
#ifndef WX_COMMON_H
#define WX_COMMON_H
#include "common.h" #include "common.h"
@ -53,7 +51,4 @@ static inline bool HAS_FONT_BUG()
} }
// Tyro-specific variables // Tyro-specific variables
#include "definitions.h" #include "definitions.h"
#endif /* WX_COMMON_H */