p4lang / p4c

P4_16 reference compiler
https://p4.org/
Apache License 2.0
665 stars 442 forks source link

cpplint issue with p4c control-plane file(s) #1690

Closed hesingh closed 1 year ago

hesingh commented 5 years ago

When I run ‘make cpplint’ from p4c/build/, I see three .cpp files in p4c/control-plane being processed. However, when I use p4c/tools/cpplint.py to lint one file, I see errors. I have actually fixed several cpplint errors in this file and see these pending ones. I know how to fix them, but my question is why ‘make cpplint’ does not catch this file and other files in p4c/control-plane but p4c/tools/cpplint.py does?

hemant@ubuntu:~/p4c-cplane/tools$ ./cpplint.py ../control-plane/p4RuntimeSerializer.cpp
../control-plane/p4RuntimeSerializer.cpp:25:  Found C system header after C++ system header. Should be: p4RuntimeSerializer.h, c system, c++ system, other.  [build/include_order] [4]
../control-plane/p4RuntimeSerializer.cpp:26:  Found C system header after C++ system header. Should be: p4RuntimeSerializer.h, c system, c++ system, other.  [build/include_order] [4]
../control-plane/p4RuntimeSerializer.cpp:27:  Found C system header after C++ system header. Should be: p4RuntimeSerializer.h, c system, c++ system, other.  [build/include_order] [4]
../control-plane/p4RuntimeSerializer.cpp:28:  Found C system header after C++ system header. Should be: p4RuntimeSerializer.h, c system, c++ system, other.  [build/include_order] [4]
../control-plane/p4RuntimeSerializer.cpp:31:  Found C system header after C++ system header. Should be: p4RuntimeSerializer.h, c system, c++ system, other.  [build/include_order] [4]
Done processing ../control-plane/p4RuntimeSerializer.cpp
Total errors found: 5
hemant@ubuntu:~/p4c-cplane/tools$
hesingh commented 5 years ago

When this issue is fixed, please also fix this typo in typeSpecConverter.cpp. Add a 't' to 'bistring'.

"Only bistring fields expected in header type declaration %1%", type);
mihaibudiu commented 5 years ago

The CMakefile for control-plane has specifically a comment that indicates that this file should not be processed by cpplint.

hesingh commented 5 years ago

Maybe we can change this Issue to an enhancement so that one can run control-plane files through cpplint. It's not good that any source code in p4c does not go through cpplint. thanks.

hesingh commented 4 years ago

A PR to fix this issue has been sent out.

https://github.com/p4lang/p4c/pull/2169