Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
78e2cd1d
Commit
78e2cd1d
authored
6 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add __attribut__ to help scan-build static analyzer
parent
40bf8161
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/utils/PastisAssert.hpp
+17
-7
17 additions, 7 deletions
src/utils/PastisAssert.hpp
with
17 additions
and
7 deletions
src/utils/PastisAssert.hpp
+
17
−
7
View file @
78e2cd1d
...
...
@@ -45,19 +45,29 @@ class AssertError
~
AssertError
()
=
default
;
};
#pragma GCC diagnostic ignored "-Wattributes"
inline
bool
__attribute__
((
analyzer_noreturn
))
_pastis_assert
(
const
bool
&
assert
)
{
return
assert
;
}
#pragma GCC diagnostic pop
#ifdef NDEBUG
// Useless test is there to check syntax even in optimized mode. Costs nothing.
#define Assert(assertion) if (not (assertion)) {}
#define Assert(assertion) \
if (not _pastis_assert(assertion)) {}
#else // NDEBUG
#define Assert(assertion)
\
if (not (assertion)) {
\
throw AssertError(__FILE__,
\
__LINE__,
\
__PRETTY_FUNCTION__,
\
(#assertion));
\
#define Assert(assertion) \
if (not
_pastis_assert
(assertion)) { \
throw AssertError(__FILE__, \
__LINE__, \
__PRETTY_FUNCTION__, \
(#assertion)); \
}
#endif // NDEBUG
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment