Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .ci/linters/c/cocci_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ cocci_linter = if (!nzchar(Sys.which("spatch"))) function(...) {} else function(
stdout = TRUE, stderr = FALSE
)
if (length(out) > 0) {
cat(sprintf("In file '%s', Coccinelle linter '%s' located the following problems:\n", c_obj$path, spfile))
cat(sprintf("In file '%s', Coccinelle linter '%s' located the following problems:\n", c_obj$c_obj, spfile))
Comment thread
aitap marked this conversation as resolved.
Outdated
writeLines(out)
bad = TRUE
}
if (!is.null(status <- attr(out, 'status'))) {
cat(sprintf("While working on file '%s', Coccinelle linter '%s' failed with exit code %d:\n", c_obj$path, spfile, status))
cat(sprintf("While working on file '%s', Coccinelle linter '%s' failed with exit code %d:\n", c_obj$c_obj, spfile, status))
bad = TRUE
}
}
Expand Down
78 changes: 78 additions & 0 deletions .ci/linters/cocci/use_ro_accessors.cocci
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
@@
Comment thread
aitap marked this conversation as resolved.
type T;
const T *variable;
expression E;
@@
- variable = REAL(E)
+ variable = REAL_RO(E)

@@
type T;
const T *variable;
expression E;
@@
- variable = INTEGER(E)
+ variable = INTEGER_RO(E)

@@
type T;
const T *variable;
expression E;
@@
- variable = COMPLEX(E)
+ variable = COMPLEX_RO(E)

@@
type T;
const T *variable;
expression E;
@@
- variable = RAW(E)
Comment thread
aitap marked this conversation as resolved.
Outdated
+ variable = RAW_RO(E)

@@
type T;
const T *variable;
expression E;
@@
- variable = LOGICAL(E)
+ variable = LOGICAL_RO(E)

@@
Comment thread
aitap marked this conversation as resolved.
expression E;
@@
-(const int*) INTEGER(E)
+INTEGER_RO(E)

@@
expression E;
@@
-(const double*) REAL(E)
+REAL_RO(E)

@@
expression E;
@@
-(const int*) LOGICAL(E)
+LOGICAL_RO(E)

@@
expression E;
type T;
@@
-(const T*) RAW(E)
+RAW_RO(E)

@@
expression E;
type T;
@@
-(const T*) COMPLEX(E)
+COMPLEX_RO(E)

@@
expression E;
type T;
@@
-(const T*) STRING_PTR(E)
+STRING_PTR_RO(E)
1 change: 1 addition & 0 deletions .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
c:
- '**/*.c'
- '**/*.h'
- '.ci/linters/cocci/**/*.cocci'
po:
- 'po/**/*.po'
md:
Expand Down
Loading