forked from gcc-mirror/gcc
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libgccjit: Add option to allow special characters in function names
gcc/jit/ChangeLog: * docs/topics/contexts.rst: Add documentation for new option. * jit-recording.cc (recording::context::get_str_option): New method. * jit-recording.h (get_str_option): New method. * libgccjit.cc (gcc_jit_context_new_function): Allow special characters in function names. * libgccjit.h (enum gcc_jit_str_option): New option. gcc/testsuite/ChangeLog: * jit.dg/test-special-chars.c: New test.
- Loading branch information
Showing
6 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
|
||
#include "libgccjit.h" | ||
|
||
#include "harness.h" | ||
|
||
void | ||
create_code (gcc_jit_context *ctxt, void *user_data) | ||
{ | ||
gcc_jit_context_set_str_option (ctxt, | ||
GCC_JIT_STR_OPTION_SPECIAL_CHARS_IN_FUNC_NAMES, "$."); | ||
|
||
/* Let's try to inject the equivalent of: | ||
void | ||
name$with.special_chars (void) | ||
{ | ||
} | ||
*/ | ||
gcc_jit_type *void_type = | ||
gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_VOID); | ||
|
||
/* Build the test_fn. */ | ||
gcc_jit_function *test_fn = | ||
gcc_jit_context_new_function (ctxt, NULL, | ||
GCC_JIT_FUNCTION_EXPORTED, | ||
void_type, | ||
"name$with.special_chars", | ||
0, NULL, | ||
0); | ||
|
||
gcc_jit_block *block = gcc_jit_function_new_block (test_fn, NULL); | ||
gcc_jit_block_end_with_void_return ( | ||
block, NULL); | ||
} | ||
|
||
void | ||
verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) | ||
{ | ||
CHECK_NON_NULL (result); | ||
} |