electron/patches/node/fix_-wshadow_warning.patch
electron-roller[bot] 653d0f009e
chore: bump node to v20.13.1 (main) (#42088)
* chore: bump node in DEPS to v20.13.0

* crypto: enable NODE_EXTRA_CA_CERTS with BoringSSL

https://github.com/nodejs/node/pull/52217

* test: skip test for dynamically linked OpenSSL

https://github.com/nodejs/node/pull/52542

* lib, url: add a `windows` option to path parsing

https://github.com/nodejs/node/pull/52509

* src: use dedicated routine to compile function for builtin CJS loader

https://github.com/nodejs/node/pull/52016

* test: mark test as flaky

https://github.com/nodejs/node/pull/52671

* build,tools: add test-ubsan ci

https://github.com/nodejs/node/pull/46297

* src: preload function for Environment

https://github.com/nodejs/node/pull/51539

* chore: fixup patch indices

* deps: update c-ares to 1.28.1

https://github.com/nodejs/node/pull/52285

* chore: handle updated filenames

- https://github.com/nodejs/node/pull/51999
- https://github.com/nodejs/node/pull/51927

* chore: bump node in DEPS to v20.13.1

* events: extract addAbortListener for safe internal use

https://github.com/nodejs/node/pull/52081

* module: print location of unsettled top-level await in entry points

https://github.com/nodejs/node/pull/51999

* fs: add stacktrace to fs/promises

https://github.com/nodejs/node/pull/49849

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2024-05-13 11:43:14 -04:00

45 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Charles Kerr <charles@charleskerr.com>
Date: Fri, 7 Jul 2023 11:28:19 -0500
Subject: fix: -Wshadow warning
In utils.h's `ERROR_AND_ABORT` macro, rename the static local variable
`args` to avoid -Wshadow warnings in code that calls `ERROR_AND_ABORT()`
or `CHECK()` from a function that already has an `args` variable.
This patch could be removed after upstreaming to Node.js.
Example warning:
In file included from ../../third_party/electron_node/src/inspector/runtime_agent.cc:3:
In file included from ../../third_party/electron_node/src/env-inl.h:32:
../../third_party/electron_node/src/node_internals.h:72:3: error: declaration shadows a local variable [-Werror,-Wshadow]
72 | CHECK(args[0]->IsObject());
| ^
../../third_party/electron_node/src/util.h:154:7: note: expanded from macro 'CHECK'
154 | ERROR_AND_ABORT(expr); \
| ^
../../third_party/electron_node/src/util.h:132:38: note: expanded from macro 'ERROR_AND_ABORT'
132 | static const node::AssertionInfo args = { \
| ^
../../third_party/electron_node/src/node_internals.h:67:67: note: previous declaration is here
67 | void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>& args) {
| ^
1 error generated.
diff --git a/src/util.h b/src/util.h
index cd4fe2e422a7843f5a3f0f4b336a8625a0b24bcf..8edd50e598d8612144b8da9236e63f9079b99156 100644
--- a/src/util.h
+++ b/src/util.h
@@ -146,9 +146,9 @@ void DumpJavaScriptBacktrace(FILE* fp);
do { \
/* Make sure that this struct does not end up in inline code, but */ \
/* rather in a read-only data section when modifying this code. */ \
- static const node::AssertionInfo args = { \
+ static const node::AssertionInfo error_and_abort_args = { \
__FILE__ ":" STRINGIFY(__LINE__), #expr, PRETTY_FUNCTION_NAME}; \
- node::Assert(args); \
+ node::Assert(error_and_abort_args); \
/* `node::Assert` doesn't return. Add an [[noreturn]] abort() here to */ \
/* make the compiler happy about no return value in the caller */ \
/* function when calling ERROR_AND_ABORT. */ \