Skip to content

Commit 75ef279

Browse files
committed
libgccjit: Accept more flags
1 parent dfbee71 commit 75ef279

4 files changed

Lines changed: 110 additions & 11 deletions

File tree

gcc/jit/dummy-frontend.cc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,6 +2029,30 @@ jit_langhook_type_promotes_to (tree type)
20292029
return type;
20302030
}
20312031

2032+
static unsigned int
2033+
jit_langhook_option_lang_mask (void)
2034+
{
2035+
return CL_LibGCCJIT;
2036+
}
2037+
2038+
#undef LANG_HOOKS_OPTION_LANG_MASK
2039+
#define LANG_HOOKS_OPTION_LANG_MASK jit_langhook_option_lang_mask
2040+
2041+
static bool
2042+
jit_langhook_handle_option (
2043+
size_t code ATTRIBUTE_UNUSED,
2044+
const char *arg ATTRIBUTE_UNUSED,
2045+
HOST_WIDE_INT value ATTRIBUTE_UNUSED,
2046+
int kind ATTRIBUTE_UNUSED,
2047+
location_t loc ATTRIBUTE_UNUSED,
2048+
const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
2049+
{
2050+
return true;
2051+
}
2052+
2053+
#undef LANG_HOOKS_HANDLE_OPTION
2054+
#define LANG_HOOKS_HANDLE_OPTION jit_langhook_handle_option
2055+
20322056
#undef LANG_HOOKS_EH_PERSONALITY
20332057
#define LANG_HOOKS_EH_PERSONALITY jit_langhook_eh_personality
20342058

gcc/jit/lang.opt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
; Options for libgccjit.
2+
; Copyright (C) 2026 Free Software Foundation, Inc.
3+
;
4+
; This file is part of GCC.
5+
;
6+
; GCC is free software; you can redistribute it and/or modify it under
7+
; the terms of the GNU General Public License as published by the Free
8+
; Software Foundation; either version 3, or (at your option) any later
9+
; version.
10+
;
11+
; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12+
; WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
; for more details.
15+
;
16+
; You should have received a copy of the GNU General Public License
17+
; along with GCC; see the file COPYING3. If not see
18+
; <http://www.gnu.org/licenses/>.
19+
20+
; See the GCC internals manual for a description of this file's format.
21+
22+
; Please try to keep this file in ASCII collating order.
23+
24+
Language
25+
LibGCCJIT
26+
27+
Wif-not-aligned
28+
LibGCCJIT
29+
; Documented in C
30+
31+
Wpsabi
32+
LibGCCJIT
33+
; Documented in C
34+
35+
Wstringop-overflow=
36+
LibGCCJIT
37+
; Documented in C
38+
39+
Wstringop-overread
40+
LibGCCJIT
41+
; Documented in C
42+
43+
Wstringop-truncation
44+
LibGCCJIT
45+
; Documented in C
46+
47+
Wsync-nand
48+
LibGCCJIT
49+
; Documented in C
50+
51+
Wunused-result
52+
LibGCCJIT
53+
; Documented in C

gcc/jit/lang.opt.urls

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
; Autogenerated by regenerate-opt-urls.py from gcc/jit/lang.opt and generated HTML
2+
3+
Wif-not-aligned
4+
UrlSuffix(gcc/Warning-Options.html#index-Wif-not-aligned)
5+
6+
Wpsabi
7+
UrlSuffix(gcc/Warning-Options.html#index-Wno-psabi)
8+
9+
Wstringop-overflow=
10+
UrlSuffix(gcc/Warning-Options.html#index-Wno-stringop-overflow)
11+
12+
Wstringop-overread
13+
UrlSuffix(gcc/Warning-Options.html#index-Wno-stringop-overread)
14+
15+
Wstringop-truncation
16+
UrlSuffix(gcc/Warning-Options.html#index-Wno-stringop-truncation)
17+
18+
Wsync-nand
19+
UrlSuffix(gcc/Warning-Options.html#index-Wno-sync-nand)
20+
21+
Wunused-result
22+
UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-result)

gcc/opts.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ extern const struct cl_var cl_vars[];
164164
extern const char *const lang_names[];
165165
extern const unsigned int cl_lang_count;
166166

167-
#define CL_PARAMS (1U << 16) /* Fake entry. Used to display --param info with --help. */
168-
#define CL_WARNING (1U << 17) /* Enables an (optional) warning message. */
169-
#define CL_OPTIMIZATION (1U << 18) /* Enables an (optional) optimization. */
170-
#define CL_DRIVER (1U << 19) /* Driver option. */
171-
#define CL_TARGET (1U << 20) /* Target-specific option. */
172-
#define CL_COMMON (1U << 21) /* Language-independent. */
167+
#define CL_PARAMS (1U << 17) /* Fake entry. Used to display --param info with --help. */
168+
#define CL_WARNING (1U << 18) /* Enables an (optional) warning message. */
169+
#define CL_OPTIMIZATION (1U << 19) /* Enables an (optional) optimization. */
170+
#define CL_DRIVER (1U << 20) /* Driver option. */
171+
#define CL_TARGET (1U << 21) /* Target-specific option. */
172+
#define CL_COMMON (1U << 22) /* Language-independent. */
173173

174174
#define CL_MIN_OPTION_CLASS CL_PARAMS
175175
#define CL_MAX_OPTION_CLASS CL_COMMON
@@ -179,11 +179,11 @@ extern const unsigned int cl_lang_count;
179179
This distinction is important because --help will not list options
180180
which only have these higher bits set. */
181181

182-
#define CL_JOINED (1U << 22) /* If takes joined argument. */
183-
#define CL_SEPARATE (1U << 23) /* If takes a separate argument. */
184-
#define CL_UNDOCUMENTED (1U << 24) /* Do not output with --help. */
185-
#define CL_NO_DWARF_RECORD (1U << 25) /* Do not add to producer string. */
186-
#define CL_PCH_IGNORE (1U << 26) /* Do compare state for pch. */
182+
#define CL_JOINED (1U << 23) /* If takes joined argument. */
183+
#define CL_SEPARATE (1U << 24) /* If takes a separate argument. */
184+
#define CL_UNDOCUMENTED (1U << 25) /* Do not output with --help. */
185+
#define CL_NO_DWARF_RECORD (1U << 26) /* Do not add to producer string. */
186+
#define CL_PCH_IGNORE (1U << 27) /* Do compare state for pch. */
187187

188188
/* Flags for an enumerated option argument. */
189189
#define CL_ENUM_CANONICAL (1 << 0) /* Canonical for this value. */

0 commit comments

Comments
 (0)