diff options
-rw-r--r-- | .github/bors_log_expected_warnings | 16 | ||||
-rw-r--r-- | .github/workflows/ccpp.yml | 3 | ||||
-rw-r--r-- | gcc/rust/Make-lang.in | 3 | ||||
-rw-r--r-- | gcc/rust/backend/rust-constexpr.cc | 96 |
4 files changed, 53 insertions, 65 deletions
diff --git a/.github/bors_log_expected_warnings b/.github/bors_log_expected_warnings index f25351f..0d99fd3 100644 --- a/.github/bors_log_expected_warnings +++ b/.github/bors_log_expected_warnings @@ -12,9 +12,6 @@ ../../../libffi/src/java_raw_api.c:369:3: warning: ‘ffi_prep_java_raw_closure_loc’ is deprecated [-Wdeprecated-declarations] ../../../libffi/src/x86/ffi64.c:783:1: warning: label ‘out’ defined but not used [-Wunused-label] ../../../libffi/src/x86/ffiw64.c:250:1: warning: label ‘out’ defined but not used [-Wunused-label] -../../c++tools/server.cc:490:11: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] -../../c++tools/server.cc:620:10: warning: ignoring return value of ‘int pipe(int*)’, declared with attribute warn_unused_result [-Wunused-result] -../../gcc/../libgcc/libgcov-util.c:455:9: warning: ignoring return value of ‘int chdir(const char*)’, declared with attribute warn_unused_result [-Wunused-result] ../../gcc/analyzer/diagnostic-manager.cc:784:20: warning: too many arguments for format [-Wformat-extra-args] ../../gcc/analyzer/diagnostic-manager.cc:784:28: warning: unknown conversion type character ‘E’ in format [-Wformat=] ../../gcc/analyzer/engine.cc:1652:3: warning: too many arguments for format [-Wformat-extra-args] @@ -84,23 +81,10 @@ ../../gcc/config/i386/i386.cc:2565:8: warning: unknown conversion type character ‘}’ in format [-Wformat=] ../../gcc/diagnostic.cc:2206:52: warning: format not a string literal and no format arguments [-Wformat-security] ../../gcc/fold-const.cc:314:42: warning: format not a string literal and no format arguments [-Wformat-security] -../../gcc/gcc.cc:10475:12: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] -../../gcc/gcc.cc:7708:9: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] -../../gcc/gcc.cc:7711:13: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] -../../gcc/gcc.cc:7712:13: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] -../../gcc/gcc.cc:7714:9: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] -../../gcc/genhooks.cc:112:17: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] -../../gcc/genhooks.cc:121:14: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] -../../gcc/genhooks.cc:174:14: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] -../../gcc/genhooks.cc:180:14: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] ../../gcc/gimple-range-gori.cc:318:22: warning: format not a string literal and no format arguments [-Wformat-security] ../../gcc/ipa-devirt.cc:965:47: warning: format not a string literal and no format arguments [-Wformat-security] -../../gcc/lto-wrapper.cc:1147:8: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] ../../gcc/lto-wrapper.cc:1365:52: warning: format not a string literal and no format arguments [-Wformat-security] ../../gcc/lto-wrapper.cc:1957:44: warning: format not a string literal and no format arguments [-Wformat-security] -../../gcc/lto/lto-common.cc:2075:10: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] -../../gcc/lto/lto-common.cc:2077:9: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result] -../../gcc/lto/lto-common.cc:2097:10: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] ../../gcc/omp-low.cc:10632:19: warning: ‘T’ conversion used within a quoted sequence [-Wformat=] ../../gcc/omp-low.cc:1547:23: warning: ‘T’ conversion used within a quoted sequence [-Wformat=] ../../gcc/omp-low.cc:1552:23: warning: ‘T’ conversion used within a quoted sequence [-Wformat=] diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index c886740..22440b0 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -8,6 +8,9 @@ on: pull_request: branches: [ master ] +env: + CXXFLAGS: "-Wno-unused-parameter -Werror=overloaded-virtual" + jobs: build-and-check-ubuntu-64bit: diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in index 024fe23..58dbc09 100644 --- a/gcc/rust/Make-lang.in +++ b/gcc/rust/Make-lang.in @@ -331,8 +331,7 @@ CFLAGS-rust/rust-lex.o += $(RUST_INCLUDES) CFLAGS-rust/rust-parse.o += $(RUST_INCLUDES) CFLAGS-rust/rust-session-manager.o += $(RUST_INCLUDES) -# TODO: possibly find a way to ensure C++11 compilation level here? -RUST_CXXFLAGS = -std=c++11 -Wno-unused-parameter -Werror=overloaded-virtual +RUST_CXXFLAGS = $(CXXFLAGS) # build all rust/lex files in rust folder, add cross-folder includes rust/%.o: rust/lex/%.cc diff --git a/gcc/rust/backend/rust-constexpr.cc b/gcc/rust/backend/rust-constexpr.cc index 790a8e9..21e8bed 100644 --- a/gcc/rust/backend/rust-constexpr.cc +++ b/gcc/rust/backend/rust-constexpr.cc @@ -3658,49 +3658,48 @@ eval_call_expression (const constexpr_ctx *ctx, tree t, bool lval, whose constructor we are processing. Add the initializer to the vector and return true to indicate success. */ -static bool -build_anon_member_initialization (tree member, tree init, - vec<constructor_elt, va_gc> **vec_outer) -{ - /* MEMBER presents the relevant fields from the inside out, but we need - to build up the initializer from the outside in so that we can reuse - previously built CONSTRUCTORs if this is, say, the second field in an - anonymous struct. So we use a vec as a stack. */ - auto_vec<tree, 2> fields; - do - { - fields.safe_push (TREE_OPERAND (member, 1)); - member = TREE_OPERAND (member, 0); - } - while (ANON_AGGR_TYPE_P (TREE_TYPE (member)) - && TREE_CODE (member) == COMPONENT_REF); - - /* VEC has the constructor elements vector for the context of FIELD. - If FIELD is an anonymous aggregate, we will push inside it. */ - vec<constructor_elt, va_gc> **vec = vec_outer; - tree field; - while (field = fields.pop (), ANON_AGGR_TYPE_P (TREE_TYPE (field))) - { - tree ctor; - /* If there is already an outer constructor entry for the anonymous - aggregate FIELD, use it; otherwise, insert one. */ - if (vec_safe_is_empty (*vec) || (*vec)->last ().index != field) - { - ctor = build_constructor (TREE_TYPE (field), NULL); - CONSTRUCTOR_APPEND_ELT (*vec, field, ctor); - } - else - ctor = (*vec)->last ().value; - vec = &CONSTRUCTOR_ELTS (ctor); - } - - /* Now we're at the innermost field, the one that isn't an anonymous - aggregate. Add its initializer to the CONSTRUCTOR and we're done. */ - gcc_assert (fields.is_empty ()); - CONSTRUCTOR_APPEND_ELT (*vec, field, init); - - return true; -} +// static bool +// build_anon_member_initialization (tree member, tree init, +// vec<constructor_elt, va_gc> **vec_outer) +// { +// /* MEMBER presents the relevant fields from the inside out, but we need +// to build up the initializer from the outside in so that we can reuse +// previously built CONSTRUCTORs if this is, say, the second field in an +// anonymous struct. So we use a vec as a stack. */ +// auto_vec<tree, 2> fields; +// do +// { +// fields.safe_push (TREE_OPERAND (member, 1)); +// member = TREE_OPERAND (member, 0); +// } while (ANON_AGGR_TYPE_P (TREE_TYPE (member)) +// && TREE_CODE (member) == COMPONENT_REF); +// +// /* VEC has the constructor elements vector for the context of FIELD. +// If FIELD is an anonymous aggregate, we will push inside it. */ +// vec<constructor_elt, va_gc> **vec = vec_outer; +// tree field; +// while (field = fields.pop (), ANON_AGGR_TYPE_P (TREE_TYPE (field))) +// { +// tree ctor; +// /* If there is already an outer constructor entry for the anonymous +// aggregate FIELD, use it; otherwise, insert one. */ +// if (vec_safe_is_empty (*vec) || (*vec)->last ().index != field) +// { +// ctor = build_constructor (TREE_TYPE (field), NULL); +// CONSTRUCTOR_APPEND_ELT (*vec, field, ctor); +// } +// else +// ctor = (*vec)->last ().value; +// vec = &CONSTRUCTOR_ELTS (ctor); +// } +// +// /* Now we're at the innermost field, the one that isn't an anonymous +// aggregate. Add its initializer to the CONSTRUCTOR and we're done. */ +// gcc_assert (fields.is_empty ()); +// CONSTRUCTOR_APPEND_ELT (*vec, field, init); +// +// return true; +// } ///* V is a vector of constructor elements built up for the base and member // initializers of a constructor for TYPE. They need to be in increasing @@ -3750,7 +3749,7 @@ build_anon_member_initialization (tree member, tree init, static bool build_data_member_initialization (tree t, vec<constructor_elt, va_gc> **vec) { - tree member, init; + tree member; if (TREE_CODE (t) == CLEANUP_POINT_EXPR) t = TREE_OPERAND (t, 0); if (TREE_CODE (t) == EXPR_STMT) @@ -3835,7 +3834,8 @@ build_data_member_initialization (tree t, vec<constructor_elt, va_gc> **vec) member = TREE_OPERAND (member, 1); else if (ANON_AGGR_TYPE_P (TREE_TYPE (aggr))) /* Initializing a member of an anonymous union. */ - return build_anon_member_initialization (member, init, vec); + rust_sorry_at (Location (), "cannot handle value initialization yet"); + // return build_anon_member_initialization (member, init, vec); else /* We're initializing a vtable pointer in a base. Leave it as COMPONENT_REF so we remember the path to get to the vfield. */ @@ -3845,9 +3845,11 @@ build_data_member_initialization (tree t, vec<constructor_elt, va_gc> **vec) /* Value-initialization can produce multiple initializers for the same field; use the last one. */ if (!vec_safe_is_empty (*vec) && (*vec)->last ().index == member) - (*vec)->last ().value = init; + rust_sorry_at (Location (), "cannot handle value initialization yet"); + // (*vec)->last ().value = init; else - CONSTRUCTOR_APPEND_ELT (*vec, member, init); + rust_sorry_at (Location (), "cannot handle value initialization yet"); + // CONSTRUCTOR_APPEND_ELT (*vec, member, init); return true; } |