diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3a5c4a02a7..3f6e8dcb35 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,7 +21,7 @@ variables: ASAN_SYMBOLIZER_PATH: /usr/lib/llvm-13/bin/llvm-symbolizer CLANG_FORMAT: clang-format-13 - CFLAGS_COMMON: -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -g -Wall -Wextra + CFLAGS_COMMON: -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -g -Wall -Wextra # Pass run-time flags to AddressSanitizer to get core dumps on error. ASAN_OPTIONS: abort_on_error=1:disable_coredump=0:unmap_shadow_on_exit=1 diff --git a/doc/dev/style.md b/doc/dev/style.md index fb8e361bf3..6781835fd7 100644 --- a/doc/dev/style.md +++ b/doc/dev/style.md @@ -79,7 +79,7 @@ conform well to BIND 9 C style: set showmode set autoindent set expandtab - + filetype plugin on let c_syntax_for_h = 1 autocmd FileType c,cc,cpp set cindent @@ -87,7 +87,7 @@ conform well to BIND 9 C style: autocmd FileType c,cc,cpp set fo=rotcq autocmd FileType c,cc,cpp set noexpandtab ts=8 autocmd FileType python set ts=4 sw=4 - + filetype indent on #### Vertical Whitespace @@ -137,7 +137,7 @@ Good: /* * Private variables. */ - + static int a /* Description of 'a'. */ static int b /* Description of 'b'. */ static char * c /* Description of 'c'. */ @@ -187,13 +187,13 @@ or for public files that do not declare any functions. * License, v. 2.0. If a copy of the MPL was not distributed with this * file, you can obtain one at https://mozilla.org/MPL/2.0/. */ - + #pragma once - + /***** ***** Module Info *****/ - + /* * (Module name here.) * @@ -217,20 +217,20 @@ or for public files that do not declare any functions. * Standards: * (Any standards relevant to the module are listed here.) */ - + /*** *** Imports ***/ - + /* #includes here. */ #include - + /*** *** Types ***/ - + /* (Type definitions here.) */ - + /*** *** Functions ***/ @@ -274,7 +274,7 @@ list is more than one line long: func1(int i) { /* whatever */ } - + int func2(int first_argument, int next_argument, int last_argument) @@ -372,7 +372,7 @@ Good: os_result_t result; os_descriptor_t s; - + result = os_socket_create(AF_INET, SOCK_STREAM, 0, &s); if (result != OS_R_SUCCESS) { /* Do something about the error. */ @@ -382,7 +382,7 @@ Good: Not so good: int s; - + /* * Obviously using interfaces like socket() (below) is allowed * since otherwise you couldn't call operating system routines; the @@ -433,26 +433,26 @@ Good: /* Test if flag set. */ if ((flags & FOO) != 0) { - + } /* Test if flag clear. */ if ((flags & BAR) == 0) { - + } /* Test if both flags set. */ if ((flags & (FOO|BAR)) == (FOO|BAR)) { - + } Bad: /* Test if flag set. */ if (flags & FOO) { - + } /* Test if flag clear. */ if (! (flags & BAR)) { - + } #### Testing for Zero or Non-zero @@ -463,9 +463,9 @@ variables. Good: int i = 10; - + /* ... */ - + if (i != 0) { /* Do something. */ } @@ -473,9 +473,9 @@ Good: Bad: int i = 10; - + /* ... */ - + if (i) { /* Do something. */ } @@ -490,9 +490,9 @@ comparison; do not treat a pointer variable as if it were a boolean. Good: char *c = NULL; - + /* ... */ - + if (c != NULL) { /* Do something. */ } @@ -500,9 +500,9 @@ Good: Bad: char *c = NULL; - + /* ... */ - + if (c) { /* Do something. */ } @@ -563,9 +563,9 @@ structure which is itself going to be freed immediately. Good: char *text; - + /* text is initialized here. */ - + isc_mem_free(mctx, text); text = NULL; @@ -636,7 +636,7 @@ Good: int bar; int baz; }; - + struct example x = { .foo = -1 }; Bad: @@ -645,9 +645,9 @@ Bad: int bar; int baz; }; - + struct example x; - + x.foo = -1; x.bar = 0; x.baz = 0; @@ -658,9 +658,9 @@ Good: int bar; int baz; }; - + struct example *x = isc_mem_get(mctx, sizeof(*x)); - + *x = (struct example){ .foo = -1 }; Bad: @@ -669,9 +669,9 @@ Bad: int bar; int baz; }; - + struct example *x = isc_mem_get(mctx, sizeof(*x)); - + x->foo = -1; x->bar = 0; x->baz = 0; @@ -744,7 +744,7 @@ value of the format parameter: dns_zone_setfile(dns_zone_t *zone, const char *file) { return (dns_zone_setfile2(zone, file, dns_masterformat_text); } - + isc_result_t dns_zone_setfile2(dns_zone_t *zone, const char *file, dns_masterformat_t format)