Skip to content

Commit

Permalink
chore: add ELECTRON_ prefix to C++ include guards (electron#31925)
Browse files Browse the repository at this point in the history
  • Loading branch information
miniak authored and t57ser committed Jan 25, 2022
1 parent c92956d commit 97a367e
Show file tree
Hide file tree
Showing 358 changed files with 1,080 additions and 1,079 deletions.
4 changes: 2 additions & 2 deletions docs/development/creating-api.md
Expand Up @@ -50,8 +50,8 @@ In your `api_name.h` file:

```cpp title='api_name.h'

#ifndef SHELL_BROWSER_API_ELECTRON_API_{API_NAME}_H_
#define SHELL_BROWSER_API_ELECTRON_API_{API_NAME}_H_
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_{API_NAME}_H_
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_{API_NAME}_H_

#include "gin/handle.h"
#include "gin/wrappable.h"
Expand Down
19 changes: 10 additions & 9 deletions script/lint.js
Expand Up @@ -9,8 +9,9 @@ const klaw = require('klaw');
const minimist = require('minimist');
const path = require('path');

const SOURCE_ROOT = path.normalize(path.dirname(__dirname));
const DEPOT_TOOLS = path.resolve(SOURCE_ROOT, '..', 'third_party', 'depot_tools');
const ELECTRON_ROOT = path.normalize(path.dirname(__dirname));
const SOURCE_ROOT = path.resolve(ELECTRON_ROOT, '..');
const DEPOT_TOOLS = path.resolve(SOURCE_ROOT, 'third_party', 'depot_tools');

const IGNORELIST = new Set([
['shell', 'browser', 'resources', 'win', 'resource.h'],
Expand All @@ -19,7 +20,7 @@ const IGNORELIST = new Set([
['spec', 'ts-smoke', 'electron', 'main.ts'],
['spec', 'ts-smoke', 'electron', 'renderer.ts'],
['spec', 'ts-smoke', 'runner.js']
].map(tokens => path.join(SOURCE_ROOT, ...tokens)));
].map(tokens => path.join(ELECTRON_ROOT, ...tokens)));

const IS_WINDOWS = process.platform === 'win32';

Expand Down Expand Up @@ -101,7 +102,7 @@ const LINTERS = [{
run: (opts, filenames) => {
const rcfile = path.join(DEPOT_TOOLS, 'pylintrc');
const args = ['--rcfile=' + rcfile, ...filenames];
const env = Object.assign({ PYTHONPATH: path.join(SOURCE_ROOT, 'script') }, process.env);
const env = Object.assign({ PYTHONPATH: path.join(ELECTRON_ROOT, 'script') }, process.env);
spawnAndCheckExitCode('pylint', args, { env });
}
}, {
Expand Down Expand Up @@ -142,7 +143,7 @@ const LINTERS = [{
run: (opts, filenames) => {
const allOk = filenames.map(filename => {
const env = Object.assign({
CHROMIUM_BUILDTOOLS_PATH: path.resolve(SOURCE_ROOT, '..', 'buildtools'),
CHROMIUM_BUILDTOOLS_PATH: path.resolve(ELECTRON_ROOT, '..', 'buildtools'),
DEPOT_TOOLS_WIN_TOOLCHAIN: '0'
}, process.env);
// Users may not have depot_tools in PATH.
Expand Down Expand Up @@ -277,7 +278,7 @@ async function findFiles (args, linter) {

// build the includelist
if (args.changed) {
includelist = await findChangedFiles(SOURCE_ROOT);
includelist = await findChangedFiles(ELECTRON_ROOT);
if (!includelist.size) {
return [];
}
Expand All @@ -287,12 +288,12 @@ async function findFiles (args, linter) {

// accumulate the raw list of files
for (const root of linter.roots) {
const files = await findMatchingFiles(path.join(SOURCE_ROOT, root), linter.test);
const files = await findMatchingFiles(path.join(ELECTRON_ROOT, root), linter.test);
filenames.push(...files);
}

for (const ignoreRoot of (linter.ignoreRoots) || []) {
const ignorePath = path.join(SOURCE_ROOT, ignoreRoot);
const ignorePath = path.join(ELECTRON_ROOT, ignoreRoot);
if (!fs.existsSync(ignorePath)) continue;

const ignoreFiles = new Set(await findMatchingFiles(ignorePath, linter.test));
Expand All @@ -310,7 +311,7 @@ async function findFiles (args, linter) {
// it's important that filenames be relative otherwise clang-format will
// produce patches with absolute paths in them, which `git apply` will refuse
// to apply.
return filenames.map(x => path.relative(SOURCE_ROOT, x));
return filenames.map(x => path.relative(ELECTRON_ROOT, x));
}

async function main () {
Expand Down
6 changes: 3 additions & 3 deletions shell/app/command_line_args.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_APP_COMMAND_LINE_ARGS_H_
#define SHELL_APP_COMMAND_LINE_ARGS_H_
#ifndef ELECTRON_SHELL_APP_COMMAND_LINE_ARGS_H_
#define ELECTRON_SHELL_APP_COMMAND_LINE_ARGS_H_

#include "base/command_line.h"

Expand All @@ -14,4 +14,4 @@ bool IsSandboxEnabled(base::CommandLine* command_line);

} // namespace electron

#endif // SHELL_APP_COMMAND_LINE_ARGS_H_
#endif // ELECTRON_SHELL_APP_COMMAND_LINE_ARGS_H_
6 changes: 3 additions & 3 deletions shell/app/electron_content_client.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_APP_ELECTRON_CONTENT_CLIENT_H_
#define SHELL_APP_ELECTRON_CONTENT_CLIENT_H_
#ifndef ELECTRON_SHELL_APP_ELECTRON_CONTENT_CLIENT_H_
#define ELECTRON_SHELL_APP_ELECTRON_CONTENT_CLIENT_H_

#include <vector>

Expand Down Expand Up @@ -38,4 +38,4 @@ class ElectronContentClient : public content::ContentClient {

} // namespace electron

#endif // SHELL_APP_ELECTRON_CONTENT_CLIENT_H_
#endif // ELECTRON_SHELL_APP_ELECTRON_CONTENT_CLIENT_H_
6 changes: 3 additions & 3 deletions shell/app/electron_crash_reporter_client.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SHELL_APP_ELECTRON_CRASH_REPORTER_CLIENT_H_
#define SHELL_APP_ELECTRON_CRASH_REPORTER_CLIENT_H_
#ifndef ELECTRON_SHELL_APP_ELECTRON_CRASH_REPORTER_CLIENT_H_
#define ELECTRON_SHELL_APP_ELECTRON_CRASH_REPORTER_CLIENT_H_

#include <map>
#include <string>
Expand Down Expand Up @@ -91,4 +91,4 @@ class ElectronCrashReporterClient : public crash_reporter::CrashReporterClient {
~ElectronCrashReporterClient() override;
};

#endif // SHELL_APP_ELECTRON_CRASH_REPORTER_CLIENT_H_
#endif // ELECTRON_SHELL_APP_ELECTRON_CRASH_REPORTER_CLIENT_H_
6 changes: 3 additions & 3 deletions shell/app/electron_library_main.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_APP_ELECTRON_LIBRARY_MAIN_H_
#define SHELL_APP_ELECTRON_LIBRARY_MAIN_H_
#ifndef ELECTRON_SHELL_APP_ELECTRON_LIBRARY_MAIN_H_
#define ELECTRON_SHELL_APP_ELECTRON_LIBRARY_MAIN_H_

#include "build/build_config.h"
#include "electron/buildflags/buildflags.h"
Expand All @@ -20,4 +20,4 @@ __attribute__((visibility("default"))) int ElectronInitializeICUandStartNode(
}
#endif // OS_MAC

#endif // SHELL_APP_ELECTRON_LIBRARY_MAIN_H_
#endif // ELECTRON_SHELL_APP_ELECTRON_LIBRARY_MAIN_H_
6 changes: 3 additions & 3 deletions shell/app/electron_main.h
Expand Up @@ -2,9 +2,9 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_APP_ELECTRON_MAIN_H_
#define SHELL_APP_ELECTRON_MAIN_H_
#ifndef ELECTRON_SHELL_APP_ELECTRON_MAIN_H_
#define ELECTRON_SHELL_APP_ELECTRON_MAIN_H_

#include "content/public/app/content_main.h"

#endif // SHELL_APP_ELECTRON_MAIN_H_
#endif // ELECTRON_SHELL_APP_ELECTRON_MAIN_H_
6 changes: 3 additions & 3 deletions shell/app/electron_main_delegate.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_APP_ELECTRON_MAIN_DELEGATE_H_
#define SHELL_APP_ELECTRON_MAIN_DELEGATE_H_
#ifndef ELECTRON_SHELL_APP_ELECTRON_MAIN_DELEGATE_H_
#define ELECTRON_SHELL_APP_ELECTRON_MAIN_DELEGATE_H_

#include <memory>
#include <string>
Expand Down Expand Up @@ -66,4 +66,4 @@ class ElectronMainDelegate : public content::ContentMainDelegate {

} // namespace electron

#endif // SHELL_APP_ELECTRON_MAIN_DELEGATE_H_
#endif // ELECTRON_SHELL_APP_ELECTRON_MAIN_DELEGATE_H_
6 changes: 3 additions & 3 deletions shell/app/electron_main_delegate_mac.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SHELL_APP_ELECTRON_MAIN_DELEGATE_MAC_H_
#define SHELL_APP_ELECTRON_MAIN_DELEGATE_MAC_H_
#ifndef ELECTRON_SHELL_APP_ELECTRON_MAIN_DELEGATE_MAC_H_
#define ELECTRON_SHELL_APP_ELECTRON_MAIN_DELEGATE_MAC_H_

namespace electron {

Expand All @@ -12,4 +12,4 @@ void RegisterAtomCrApp();

} // namespace electron

#endif // SHELL_APP_ELECTRON_MAIN_DELEGATE_MAC_H_
#endif // ELECTRON_SHELL_APP_ELECTRON_MAIN_DELEGATE_MAC_H_
6 changes: 3 additions & 3 deletions shell/app/node_main.h
Expand Up @@ -2,13 +2,13 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_APP_NODE_MAIN_H_
#define SHELL_APP_NODE_MAIN_H_
#ifndef ELECTRON_SHELL_APP_NODE_MAIN_H_
#define ELECTRON_SHELL_APP_NODE_MAIN_H_

namespace electron {

int NodeMain(int argc, char* argv[]);

} // namespace electron

#endif // SHELL_APP_NODE_MAIN_H_
#endif // ELECTRON_SHELL_APP_NODE_MAIN_H_
6 changes: 3 additions & 3 deletions shell/app/uv_task_runner.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_APP_UV_TASK_RUNNER_H_
#define SHELL_APP_UV_TASK_RUNNER_H_
#ifndef ELECTRON_SHELL_APP_UV_TASK_RUNNER_H_
#define ELECTRON_SHELL_APP_UV_TASK_RUNNER_H_

#include <map>

Expand Down Expand Up @@ -47,4 +47,4 @@ class UvTaskRunner : public base::SingleThreadTaskRunner {

} // namespace electron

#endif // SHELL_APP_UV_TASK_RUNNER_H_
#endif // ELECTRON_SHELL_APP_UV_TASK_RUNNER_H_
6 changes: 3 additions & 3 deletions shell/browser/api/electron_api_app.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_BROWSER_API_ELECTRON_API_APP_H_
#define SHELL_BROWSER_API_ELECTRON_API_APP_H_
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_APP_H_
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_APP_H_

#include <map>
#include <memory>
Expand Down Expand Up @@ -271,4 +271,4 @@ class App : public ElectronBrowserClient::Delegate,

} // namespace electron

#endif // SHELL_BROWSER_API_ELECTRON_API_APP_H_
#endif // ELECTRON_SHELL_BROWSER_API_ELECTRON_API_APP_H_
6 changes: 3 additions & 3 deletions shell/browser/api/electron_api_auto_updater.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_BROWSER_API_ELECTRON_API_AUTO_UPDATER_H_
#define SHELL_BROWSER_API_ELECTRON_API_AUTO_UPDATER_H_
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_AUTO_UPDATER_H_
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_AUTO_UPDATER_H_

#include <string>

Expand Down Expand Up @@ -64,4 +64,4 @@ class AutoUpdater : public gin::Wrappable<AutoUpdater>,

} // namespace electron

#endif // SHELL_BROWSER_API_ELECTRON_API_AUTO_UPDATER_H_
#endif // ELECTRON_SHELL_BROWSER_API_ELECTRON_API_AUTO_UPDATER_H_
6 changes: 3 additions & 3 deletions shell/browser/api/electron_api_base_window.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_BROWSER_API_ELECTRON_API_BASE_WINDOW_H_
#define SHELL_BROWSER_API_ELECTRON_API_BASE_WINDOW_H_
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_BASE_WINDOW_H_
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_BASE_WINDOW_H_

#include <map>
#include <memory>
Expand Down Expand Up @@ -287,4 +287,4 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,

} // namespace electron

#endif // SHELL_BROWSER_API_ELECTRON_API_BASE_WINDOW_H_
#endif // ELECTRON_SHELL_BROWSER_API_ELECTRON_API_BASE_WINDOW_H_
6 changes: 3 additions & 3 deletions shell/browser/api/electron_api_browser_view.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_BROWSER_API_ELECTRON_API_BROWSER_VIEW_H_
#define SHELL_BROWSER_API_ELECTRON_API_BROWSER_VIEW_H_
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_BROWSER_VIEW_H_
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_BROWSER_VIEW_H_

#include <memory>
#include <string>
Expand Down Expand Up @@ -94,4 +94,4 @@ class BrowserView : public gin::Wrappable<BrowserView>,

} // namespace electron

#endif // SHELL_BROWSER_API_ELECTRON_API_BROWSER_VIEW_H_
#endif // ELECTRON_SHELL_BROWSER_API_ELECTRON_API_BROWSER_VIEW_H_
6 changes: 3 additions & 3 deletions shell/browser/api/electron_api_browser_window.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_BROWSER_API_ELECTRON_API_BROWSER_WINDOW_H_
#define SHELL_BROWSER_API_ELECTRON_API_BROWSER_WINDOW_H_
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_BROWSER_WINDOW_H_
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_BROWSER_WINDOW_H_

#include <string>
#include <vector>
Expand Down Expand Up @@ -133,4 +133,4 @@ class BrowserWindow : public BaseWindow,

} // namespace electron

#endif // SHELL_BROWSER_API_ELECTRON_API_BROWSER_WINDOW_H_
#endif // ELECTRON_SHELL_BROWSER_API_ELECTRON_API_BROWSER_WINDOW_H_
6 changes: 3 additions & 3 deletions shell/browser/api/electron_api_cookies.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_BROWSER_API_ELECTRON_API_COOKIES_H_
#define SHELL_BROWSER_API_ELECTRON_API_COOKIES_H_
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_COOKIES_H_
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_COOKIES_H_

#include <string>

Expand Down Expand Up @@ -72,4 +72,4 @@ class Cookies : public gin::Wrappable<Cookies>,

} // namespace electron

#endif // SHELL_BROWSER_API_ELECTRON_API_COOKIES_H_
#endif // ELECTRON_SHELL_BROWSER_API_ELECTRON_API_COOKIES_H_
6 changes: 3 additions & 3 deletions shell/browser/api/electron_api_crash_reporter.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_BROWSER_API_ELECTRON_API_CRASH_REPORTER_H_
#define SHELL_BROWSER_API_ELECTRON_API_CRASH_REPORTER_H_
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_CRASH_REPORTER_H_
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_CRASH_REPORTER_H_

#include <map>
#include <string>
Expand Down Expand Up @@ -38,4 +38,4 @@ void Start(const std::string& submit_url,

} // namespace electron

#endif // SHELL_BROWSER_API_ELECTRON_API_CRASH_REPORTER_H_
#endif // ELECTRON_SHELL_BROWSER_API_ELECTRON_API_CRASH_REPORTER_H_
6 changes: 3 additions & 3 deletions shell/browser/api/electron_api_data_pipe_holder.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_BROWSER_API_ELECTRON_API_DATA_PIPE_HOLDER_H_
#define SHELL_BROWSER_API_ELECTRON_API_DATA_PIPE_HOLDER_H_
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_DATA_PIPE_HOLDER_H_
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_DATA_PIPE_HOLDER_H_

#include <string>

Expand Down Expand Up @@ -53,4 +53,4 @@ class DataPipeHolder : public gin::Wrappable<DataPipeHolder> {

} // namespace electron

#endif // SHELL_BROWSER_API_ELECTRON_API_DATA_PIPE_HOLDER_H_
#endif // ELECTRON_SHELL_BROWSER_API_ELECTRON_API_DATA_PIPE_HOLDER_H_
6 changes: 3 additions & 3 deletions shell/browser/api/electron_api_debugger.h
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef SHELL_BROWSER_API_ELECTRON_API_DEBUGGER_H_
#define SHELL_BROWSER_API_ELECTRON_API_DEBUGGER_H_
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_DEBUGGER_H_
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_DEBUGGER_H_

#include <map>

Expand Down Expand Up @@ -78,4 +78,4 @@ class Debugger : public gin::Wrappable<Debugger>,

} // namespace electron

#endif // SHELL_BROWSER_API_ELECTRON_API_DEBUGGER_H_
#endif // ELECTRON_SHELL_BROWSER_API_ELECTRON_API_DEBUGGER_H_

0 comments on commit 97a367e

Please sign in to comment.