Skip to content

Commit

Permalink
fix clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
hanw committed Feb 10, 2023
1 parent b9fd5c5 commit 87c6e94
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion backends/p4test/p4test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class P4TestOptions : public CompilerOptions {
"read previously dumped json instead of P4 source code");
registerOption(
"--turn-off-logn", nullptr,
[this](const char *arg) {
[this](const char *) {
::Log::Detail::enableLoggingGlobally = false;
return true;
},
Expand Down
6 changes: 4 additions & 2 deletions lib/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ void addDebugSpec(const char *spec);

inline bool verbose() { return Detail::verbosity > 0; }
inline int verbosity() { return Detail::verbosity; }
inline bool enableLogging() { return Detail::enableLoggingGlobally || Detail::enableLoggingInContext; }
inline bool enableLogging() {
return Detail::enableLoggingGlobally || Detail::enableLoggingInContext; }
void increaseVerbosity();

} // namespace Log
Expand All @@ -102,7 +103,8 @@ void increaseVerbosity();
#define MAX_LOGGING_LEVEL 10
#endif

#define LOGGING(N) ((N) <= MAX_LOGGING_LEVEL && ::Log::fileLogLevelIsAtLeast(__FILE__, N) && ::Log::enableLogging())
#define LOGGING(N) ((N) <= MAX_LOGGING_LEVEL && ::Log::fileLogLevelIsAtLeast(__FILE__, N) && \
::Log::enableLogging())
#define LOGN(N, X) \
(LOGGING(N) ? ::Log::Detail::fileLogOutput(__FILE__) \
<< ::Log::Detail::OutputLogPrefix(__FILE__, N) << X \
Expand Down
6 changes: 3 additions & 3 deletions testdata/p4_16_samples/ex2.p4
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ limitations under the License.
const bit<8> x = 10;
struct S { bit<8> s; }

// demonstrate how to use the __debug annotation to enable debug log
// demonstrate how to use the __debug annotation to print LOG messages
// on this action. Run this example with
// ./p4test --use-debug-annotation ex1.p4
// ./p4test --turn-off-logn ex2.p4

@__debug
action a(in S w, out bit<8> z)
action a(in S w, out bit<8> z)
{
z = x + w.s;
}

0 comments on commit 87c6e94

Please sign in to comment.