Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
142 changes: 142 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Copyright 2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# This file helps editors auto-configure whitespace settings.
#
# See here for more information about the format and editor support:
#
# https://editorconfig.org/

# This file is common to the GCC and GDB/Binutils projects. If you
# update one, please sync it with the other.

# top-most EditorConfig file
root = true

[*]
end_of_line = lf
insert_final_newline = true
tab_width = 8

# EditorConfig files
[.editorconfig]
charset = utf-8
trim_trailing_whitespace = true

# Makefile
[{Makefile,*.mk,*.am}*]
indent_style = tab
indent_size = 8
trim_trailing_whitespace = true

# ChangeLogs
[ChangeLog*]
indent_style = tab
indent_size = 8
trim_trailing_whitespace = true
charset = utf-8

# C/C++
[*.{c,h,cc}]
charset = utf-8
indent_style = tab
indent_size = 2
trim_trailing_whitespace = true

# GCC .def files. These are generally C fragments that get included
# one or more times
[gcc/**.def]
charset = utf-8
indent_style = tab
indent_size = 2
trim_trailing_whitespace = true

# Texinfo files
[*.texi]
charset = utf-8
indent_size = 2
trim_trailing_whitespace = true

# Expect / TCL
[*.{exp,tcl}]
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true

# Python
[*.py]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

# Assembler
[*.{s,S,asm}]
indent_style = tab
indent_size = 8
trim_trailing_whitespace = true

# GCC Machine description files
[gcc/config/**.md]
indent_style = tab
indent_size = 2
trim_trailing_whitespace = true

# Awk
[*.awk]
indent_style = tab
indent_size = 2
trim_trailing_whitespace = true

# Autoconf
[*.{ac,m4}]
indent_style = tab
indent_size = 2
trim_trailing_whitespace = true

# Shell scripts
[*.sh]
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true

# Ada
[*.ad[bs]]
indent_style = space
indent_size = 3
trim_trailing_whitespace = true

# D
[*.d]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

# Go
[*.go]
indent_style = tab
indent_size = 8
trim_trailing_whitespace = true

# Fortran
[*.[Ff]90]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

# Cobol
[*.cbl]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
121 changes: 121 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Git has the notion of hooks, which are custom scripts that are run on
# specific events. One of these hooks is the pre-commit hook (located at
# .git/hooks/pre-commit), which is run when committing, before specifying a
# message.
#
# To ease management of the pre-commit hook, the pre-commit framework
# ( https://pre-commit.com ) was developed. This is the configuration file
# for that framework. It contains a list of hooks, with information on where
# to find them and on which files to run them.
#
# See here ( https://pre-commit.com/#install ) on how to install the
# pre-commit framework.
#
# To run all the hooks specified in this file manually, you can do:
# $ pre-commit run
#
# To run some hooks and skip others, you can use environment variable SKIP:
# $ SKIP=flake8,isort pre-commit run
#
# To install the pre-commit framework in the repository in order to run the
# hooks on every commit, do:
# $ pre-commit install
#
# After installing the pre-commit framework, you can skip running all
# pre-commit hooks using --no-verify, or some using SKIP.
# $ git commit --no-verify ...
# $ SKIP=flake8,isort git commit ...
#
# In case some of these hooks don't work for you, you can make the SKIP
# setting permanent by:
# - setting SKIP in your environment
# (this will affect all repositories where it is set)
# - setting SKIP in .git/hooks/pre-commit by adding "export SKIP=..."
# (this will affect only this repository, but it may have to be re-added
# if .git/hooks/pre-commit is regenerated)
#
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

minimum_pre_commit_version: 3.2.0
default_install_hook_types: [pre-commit, commit-msg]
default_stages: [pre-commit]
repos:
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.11.0
hooks:
- id: black
types_or: [file]
files: '^gdb/.*\.py(\.in)?$'
- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
types_or: [file]
# Run this for (in glob notation):
#
# - gdb/gdb-gdb.py.in
# - gdb/*.py
# - gdb/python/**/*.py
# - gdb/testsuite/*.py
#
files: '^gdb/.*\.py(\.in)?$'
args: [--config, gdb/setup.cfg]
- repo: https://github.com/pycqa/isort
rev: 7.0.0
hooks:
- id: isort
types_or: [file]
files: '^gdb/.*\.py(\.in)?$'
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
files: '^(gdbsupport|gdbserver|gdb/(dwarf2|tui|target|data-directory|po|system-gdbinit|mi|syscalls|arch|regformats|compile|python|guile|config|unittests|cli|testsuite/gdb.(ctf|dap|debuginfod|gdb|go|guile|mi|modula2|objc|opencl|opt|pascal|perf|replay|reverse|rocm|server|stabs|testsuite|tui|xml)))/'
args: [--config, gdb/contrib/setup.cfg]
- id: codespell
name: codespell-log
entry: gdb/contrib/codespell-log.sh
args: [--config, gdb/contrib/setup.cfg]
always_run: true
verbose: true
stages: [commit-msg]
- repo: local
hooks:
- id: check-include-guards
name: check-include-guards
language: python
entry: gdb/check-include-guards.py
# All gdb header files, but not headers in the test suite.
files: '^(gdb(support|server)?)/.*\.h$'
exclude: '.*/testsuite/.*'
- id: check-gnu-style
name: check-gnu-style
language: python
additional_dependencies: ['termcolor', 'unidiff']
entry: gdb/contrib/check-gnu-style-pre-commit.sh
files: '^(gdb(support|server)?)/.*\.(c|h|cc)$'
exclude: '.*/testsuite/.*'
verbose: true
stages: [pre-commit]
- id: check-whitespace
name: check-whitespace
language: script
entry: gdb/contrib/check-whitespace-pre-commit.py
files: '^(gdb(support|server)?)/.*$'
pass_filenames: true
stages: [pre-commit]
- id: pre-commit-setup
name: pre-commit-setup
language: python
entry: gdb/contrib/pre-commit-setup.py
additional_dependencies: ["pyyaml"]
always_run: true
require_serial: true
- repo: https://github.com/nmoroze/tclint
rev: v0.7.0
hooks:
- id: tclint
args: [--commands, gdb/testsuite/tclint-plugin.py]
types_or: [file]
files: '^gdb/testsuite/.*\.(exp|tcl)$'
Loading