#include <gcc-plugin.h>
#include <plugin-version.h>
#include <function.h>
#include <tree.h>
#include <c-family/c-pragma.h>
#include <c-family/c-common.h>
#include <iostream>
#include <sstream>
#include <unordered_map>
#include <vector>
Go to the source code of this file.
◆ is_alpha
#define is_alpha |
( |
|
c | ) |
(((c)>64 && (c)<91) || ((c)>96 && (c)<123)) |
◆ UNUSED
◆ VISIBLE
◆ finish_seh_function()
Definition at line 115 of file main.cpp.
118 struct function* fun = DECL_STRUCT_FUNCTION(fndef);
128 if (DECL_FUNCTION_PERSONALITY(fndef) !=
nullptr)
130 error(
"Function %s has a personality. Are you mixing SEH with C++ exceptions ?",
131 IDENTIFIER_POINTER(fndef));
137 asm_str <<
".seh_handler __C_specific_handler";
139 asm_str <<
", @unwind";
141 asm_str <<
", @except";
143 asm_str <<
"\t.seh_handlerdata\n";
144 asm_str <<
"\t.long " << seh_fun->
count <<
"\n";
145 asm_str <<
"\t.seh_code";
148 asm_str.str().c_str(),
static short search(int val, const short *table, int size)
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
void error(const std::string &err)
static std::unordered_map< struct function *, struct seh_function * > func_seh_map
basic_stringstream< char, char_traits< char >, allocator< char > > stringstream
Referenced by plugin_init().
◆ get_seh_function()
Definition at line 61 of file main.cpp.
static short search(int val, const short *table, int size)
static std::unordered_map< struct function *, struct seh_function * > func_seh_map
Referenced by handle_seh_pragma().
◆ handle_seh_pragma()
static void handle_seh_pragma |
( |
cpp_reader *UNUSED |
parser | ) |
|
|
static |
Definition at line 75 of file main.cpp.
82 error(
"%<#pragma REACTOS seh%> is not allowed outside functions");
86 if ((pragma_lex(&
x) != CPP_OPEN_PAREN) ||
87 (pragma_lex(&
arg) != CPP_NAME) ||
88 (pragma_lex(&
x) != CPP_CLOSE_PAREN) ||
89 (pragma_lex(&
x) != CPP_EOF))
91 error(
"%<#pragma REACTOS seh%> needs one parameter%>");
95 const char*
op = IDENTIFIER_POINTER(
arg);
100 else if (
strcmp(
op,
"finally") == 0)
104 error(
"Wrong argument for %<#pragma REACTOS seh%>. Expected \"except\" or \"finally\"");
110 cfun->machine->accesses_prev_frame = 1;
GLint GLint GLint GLint GLint x
void error(const std::string &err)
static struct seh_function * get_seh_function()
int strcmp(const char *String1, const char *String2)
basic_stringstream< char, char_traits< char >, allocator< char > > stringstream
Referenced by register_seh_pragmas().
◆ plugin_init()
Definition at line 164 of file main.cpp.
167 if (!plugin_default_version_check (
version, &gcc_version))
169 std::cerr <<
"This GCC plugin is for version " << GCCPLUGIN_VERSION_MAJOR <<
"." << GCCPLUGIN_VERSION_MINOR <<
"\n";
static void finish_seh_function(void *event_data, void *UNUSED user_data)
static const WCHAR version[]
_STLP_DECLSPEC _Stl_aligned_buffer< ostream > cerr
static void register_seh_pragmas(void *UNUSED event_data, void *UNUSED user_data)
◆ register_seh_pragmas()
Definition at line 156 of file main.cpp.
static void handle_seh_pragma(cpp_reader *UNUSED parser)
Referenced by plugin_init().
◆ func_seh_map
◆ plugin_is_GPL_compatible