summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2018-04-27 17:02:18 +0100
committerTim-Philipp Müller <tim@centricular.com>2018-04-28 00:27:47 +0100
commit03b4aa3765d6c671b5759b64ac3809a822255fe2 (patch)
tree3f71f2561952a94b3c86a0448cd202b3aaf86a65 /tools
parentb1bf4c4c20b2ed78c50c401e1e36b93cfcb93e01 (diff)
orcc: add --decorator command line argument
So we can add things like FOO_API if the functions are supposed to be public, for example.
Diffstat (limited to 'tools')
-rw-r--r--tools/orcc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/orcc.c b/tools/orcc.c
index 5074e7b..7d58593 100644
--- a/tools/orcc.c
+++ b/tools/orcc.c
@@ -38,6 +38,7 @@ int use_backup = TRUE;
int use_internal = FALSE;
const char *init_function = NULL;
+const char *decorator = NULL;
char *target = "sse";
@@ -80,6 +81,7 @@ void help (void)
printf(" --no-inline Do not generate inline functions in header\n");
printf(" --internal Mark functions in header for internal visibility\n");
printf(" --no-internal Do not mark functions in header for internal visibility\n");
+ printf(" --decorator DECORATOR Decorate functions in header with DECORATOR\n");
printf(" --init-function FUNCTION Generate initialization function\n");
printf(" --lazy-init Do Orc compile at function execution\n");
printf(" --no-backup Do not generate backup functions\n");
@@ -161,6 +163,13 @@ main (int argc, char *argv[])
} else {
help();
}
+ } else if (strcmp(argv[i], "--decorator") == 0) {
+ if (i+1 < argc) {
+ decorator = argv[i+1];
+ i++;
+ } else {
+ help();
+ }
} else if (strcmp(argv[i], "--help") == 0 ||
strcmp(argv[i], "-h") == 0) {
help ();
@@ -757,6 +766,8 @@ output_code_header (OrcProgram *p, FILE *output)
{
if(use_internal) {
fprintf(output, "ORC_INTERNAL void ");
+ } else if (decorator != NULL) {
+ fprintf(output, "%s void ", decorator);
} else {
fprintf(output, "void ");
}