Skip to contentSkip to conversation

support / toolchain: use consistent code style for C code

PATCH New Peter Korsgaard 2 participants 2 messages Feb 8, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support / toolchain: use consistent code style for C code

Most, but not all our C code follows the Linux kernel code style (as documented in Documentation/process/coding-style.rst). Adjust the few places doing differently:

- Braces:
..but the preferred way, as shown to us by the prophets Kernighan and Ritchie, is to put the opening brace last on the line

- Spaces after keywords:
Use a space after (most) keywords

---
 support/scripts/check-kernel-headers.sh | 3 +--
 toolchain/toolchain-wrapper.c           | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
support/scripts/check-kernel-headers.sh +1 -2
index d1864cb05e..841df98b64 100755
@@ -53,8 +53,7 @@ int main(int argc __attribute__((unused)),
     int l = LINUX_VERSION_CODE & ~0xFF;
     int h = KERNEL_VERSION(${HDR_M},${HDR_m},0);
 
-    if(l != h)
-    {
+    if (l != h) {
         printf("Incorrect selection of kernel headers: ");
         printf("expected %d.%d.x, got %d.%d.x\n", ${HDR_M}, ${HDR_m},
                ((LINUX_VERSION_CODE>>16) & 0xFF),
toolchain/toolchain-wrapper.c +1 -1
index b7705a4cbf..8cfc963ccd 100644
@@ -434,7 +434,7 @@ int main(int argc, char **argv)
 		/* Both args below can be set at compile/link time
 		 * and are ignored correctly when not used
 		 */
-		if(i == argc)
+		if (i == argc)
 			*cur++ = "-fPIE";
 
 		if (!found_shared)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 support / toolchain: use consistent code style for C code

Peter, All,

On 2020-02-08 20:44 +0100, Peter Korsgaard spake thusly:

Quoted 4 lines

Most, but not all our C code follows the Linux kernel code style (as documented in Documentation/process/coding-style.rst). Adjust the few places doing differently:

Quoted 8 lines

- Braces:
..but the preferred way, as shown to us by the prophets Kernighan and Ritchie, is to put the opening brace last on the line

- Spaces after keywords:
Use a space after (most) keywords

I just dropped the 'support /' from the title, because both really are pretty much about the toolchain "infra".

Applied to master, thanks.

Regards,
Yann E. MORIN.

Quoted 39 lines
---
 support/scripts/check-kernel-headers.sh | 3 +--
 toolchain/toolchain-wrapper.c           | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
support/scripts/check-kernel-headers.sh +1 -2
index d1864cb05e..841df98b64 100755
@@ -53,8 +53,7 @@ int main(int argc __attribute__((unused)),
     int l = LINUX_VERSION_CODE & ~0xFF;
     int h = KERNEL_VERSION(${HDR_M},${HDR_m},0);
 
-    if(l != h)
-    {
+    if (l != h) {
         printf("Incorrect selection of kernel headers: ");
         printf("expected %d.%d.x, got %d.%d.x\n", ${HDR_M}, ${HDR_m},
                ((LINUX_VERSION_CODE>>16) & 0xFF),
toolchain/toolchain-wrapper.c +1 -1
index b7705a4cbf..8cfc963ccd 100644
@@ -434,7 +434,7 @@ int main(int argc, char **argv)
 		/* Both args below can be set at compile/link time
 		 * and are ignored correctly when not used
 		 */
-		if(i == argc)
+		if (i == argc)
 			*cur++ = "-fPIE";
 
 		if (!found_shared)
Signature · 6 lines
2.20.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'