Commit graph

13 commits

Author SHA1 Message Date
Laurent Pinchart
0bb8afc9ac libcamera: Remove spaces at end of lines
Spaces at end of lines have cropped up in a few places in libcamera.
Remove them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-05 18:25:53 +03:00
Milan Zamazal
fa52898efe clang-format: Make Qt includes matching case sensitive
Now that stable versions of all major distributions ship clang-format 12
or newer, we can use the CaseSensitive option for the Qt include
category. This fixes the problem that includes like

  #include <queue>

are put near the end.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-06-11 16:26:54 +03:00
Harvey Yang
960d0c1e19 libcamera: Remove duplicated SortIncludes in .clang-format
`SortIncludes: true` was added in both commit ae05b9f9d0
("clang-format: Enable sorted includes") and commit 0e1ff86e78
("clang-format: Regroup sort orders"), which caused issues to run
clang-format.

Fixes: 0e1ff86e78 ("clang-format: Regroup sort orders")
Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-08-02 00:50:31 +03:00
Kieran Bingham
d1cdaeb6f0 clang-format: Remove unsupported option
The CaseSensitive option requires clang-format 12 which is not widely
available.

Remove the option, to fix clang-format uses until a solution which
supports clang-format version specific configurations can be merged.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-08-27 14:04:21 +01:00
Kieran Bingham
0e1ff86e78 clang-format: Regroup sort orders
Utilise the clang-format header sort to provide a regex based pattern
match for our header inclusion coding style.

The rules are updated to match as closely as possible the existing
practices and the documentation is updated accordingly.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-11 10:33:40 +01:00
Kieran Bingham
ae05b9f9d0 clang-format: Enable sorted includes
We aim to ensure that our includes are alphabetically sorted.  Whilst
checkstyle.py also handles this, enable the clang-format explicitly to
define the code-style requirement, and allow clang-format to also
correct un-sorted header includes.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-08 14:35:37 +00:00
Laurent Pinchart
7c96b24924 clang-format: Update to reflect coding style
The libcamera coding style allows functions to be defined on a single
line only when they're inline. Update the clang-format configuration
accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-08 15:22:42 +02:00
Laurent Pinchart
4bb22013a5 clang-format: Update to clang-format-7
Add all options available in the new version that were previously
commented out (or just not listed). The commented out value is replaced
by the clang-format-7 default where they differ, to avoid changing the
current behaviour.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-03-08 15:22:29 +02:00
Laurent Pinchart
5fdca4c253 licenses: Replace deprecated GPL-2.0 with GPL-2.0-only
The GPL-2.0 SPDX identifier is deprecated, replace it with GPL-2.0-only.
The files in include/linux/ are not touched as they're copied verbatim
from the kernel sources.

Rename the GPL-2.0.txt license file to GPL-2.0-only.txt, and add a
GPL-2.0.txt symlink to support the include/linux/ headers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-15 19:51:56 +03:00
Laurent Pinchart
bd67bef8c6 clang-format: Don't indent namespaces
Our coding style doesn't indent namespace contents. Update .clang-format
accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-09-23 09:50:08 +03:00
Laurent Pinchart
bc4cace5f3 clang-format: Remove space after template
Our coding style doesn't require a space after the template keyword.
Adjust .clang-format accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-13 13:23:32 +02:00
Kieran Bingham
8400bdd19a clang-format: Enable BreakBeforeTernaryOperators
This produces code with the ternary operators at the beginning instead of the
end of the line:

       return caps_.isMultiplanar() ? getFormatMultiplane(fmt)
                                    : getFormatSingleplane(fmt);

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-02-04 16:43:09 +01:00
Laurent Pinchart
9958387034 libcamera: Add clang-format style
The initial clang-format options are copied from the Linux kernel style,
with the following differences:

- Use C++11
- Remove the line length limit (to keep the original line breaks)
- Don't indent access modifiers
- Allow short inline functions on a single line
- Move braces to next line after class definition
- Keep braces on the line of the namespace definition
- Replace for-each macros

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-22 14:30:00 +02:00