Skip to content

Commit b4e6fe3

Browse files
authored
Merge pull request #20 from GuillaumeGomez/support-returns-twice-attr
Add support for returns_twice attribute in libgccjit
2 parents 70d876b + 809825d commit b4e6fe3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

gcc/jit/jit-playback.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,8 @@ const char* fn_attribute_to_string(gcc_jit_fn_attribute attr)
529529
return "visibility";
530530
case GCC_JIT_FN_ATTRIBUTE_COLD:
531531
return "cold";
532+
case GCC_JIT_FN_ATTRIBUTE_RETURNS_TWICE:
533+
return "returns_twice";
532534
}
533535
return NULL;
534536
}
@@ -667,6 +669,9 @@ new_function (location *loc,
667669
TREE_USED (fndecl) = 1;
668670
DECL_PRESERVE_P (fndecl) = 1;
669671
}
672+
/* See handle_returns_twice_attribute in gcc/c-family/c-attribs.cc. */
673+
else if (attr == GCC_JIT_FN_ATTRIBUTE_RETURNS_TWICE)
674+
DECL_IS_RETURNS_TWICE (fndecl) = 1;
670675

671676
const char* attribute = fn_attribute_to_string (attr);
672677
if (attribute)

gcc/jit/libgccjit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,6 +2104,7 @@ enum gcc_jit_fn_attribute
21042104
GCC_JIT_FN_ATTRIBUTE_USED,
21052105
GCC_JIT_FN_ATTRIBUTE_VISIBILITY,
21062106
GCC_JIT_FN_ATTRIBUTE_COLD,
2107+
GCC_JIT_FN_ATTRIBUTE_RETURNS_TWICE,
21072108
};
21082109

21092110
/* Add an attribute to a function. */

0 commit comments

Comments
 (0)