Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 8 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,17 @@ ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the idea of grouping the eckit headers, and make them the first group! 👍🏼

IncludeCategories:
- Regex: '^<.*\.h>'
# eckit headers
- Regex: '"eckit/.*"'
Priority: 1
- Regex: "^<.*"
SortPriority: 0
# Other project headers (quoted)
- Regex: '".*"'
Priority: 2
- Regex: ".*"
# System / third-party headers (angle brackets)
- Regex: '<.*>'
Priority: 3
IncludeIsMainRegex: "([-_](test|unittest))?$"
IndentCaseLabels: true
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@ ecbuild_add_option( FEATURE HIP
DESCRIPTION "HIP GPU linear algebra operations"
REQUIRED_PACKAGES hip hipsparse )

### Self-contained header compilation test

ecbuild_add_option( FEATURE TEST_SELF_CONTAINED_HEADERS
DEFAULT OFF
DESCRIPTION "Test that each public header compiles standalone" )

### Performance tests

ecbuild_add_option( FEATURE EXTRA_TESTS
Expand Down
4 changes: 2 additions & 2 deletions regressions/ECKIT-166.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ BUG ECKIT-166

*/

#include <iostream>

#include "eckit/mpi/Comm.h"
#include "eckit/runtime/Main.h"

#include <iostream>

using namespace eckit;

void run(int argc, char** argv) {
Expand Down
9 changes: 5 additions & 4 deletions regressions/ECKIT-175.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ BUG ECKIT-175

*/

#include <cstdlib>
#include <iostream>
#include <map>

#include "eckit/log/Channel.h"
#include "eckit/log/Log.h"
#include "eckit/runtime/Main.h"
#include "eckit/runtime/Tool.h"

#include <cstdlib>
#include <iostream>
#include <string>

using namespace eckit;

void myrun() {
Expand Down
12 changes: 7 additions & 5 deletions regressions/ECKIT-221.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ FEATURE ECKIT-221

*/

#include <cstdlib>
#include <iostream>
#include <map>
#include <memory>

#include "eckit/filesystem/PathName.h"
#include "eckit/io/DataHandle.h"
#include "eckit/io/SharedBuffer.h"
#include "eckit/mpi/Comm.h"
#include "eckit/runtime/Tool.h"
#include "eckit/utils/Translator.h"

#include <cstdlib>
#include <iostream>
#include <memory>
#include <string>

using namespace eckit;

class MyTool : public Tool {
Expand Down
8 changes: 1 addition & 7 deletions src/eckit/bases/Loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
// File Loader.h
// Baudouin Raoult - ECMWF Jul 96

#ifndef eckit_Loader_h
#define eckit_Loader_h

#include "eckit/eckit.h"

#pragma once
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are touching all files, it would be nice to have a consistent spacing (my suggestion would be to consistently have an empty line before and an empty line after #pragma once).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm don't want to bother with it because I would need to code a manual check for it. clang-format does not support it and without a check it will deteriorate quickly again.

Although I agree it would look nicer.

#include "eckit/container/ClassExtent.h"

//-----------------------------------------------------------------------------
Expand All @@ -41,5 +37,3 @@ class Loader : public ClassExtent<Loader> {
//-----------------------------------------------------------------------------

} // namespace eckit

#endif
6 changes: 1 addition & 5 deletions src/eckit/bases/Watcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
// File Watcher.h
// Baudouin Raoult - ECMWF Jun 98

#ifndef eckit_Watcher_h
#define eckit_Watcher_h

#pragma once
//-----------------------------------------------------------------------------

namespace eckit {
Expand All @@ -36,5 +34,3 @@ class Watcher {
//-----------------------------------------------------------------------------

} // namespace eckit

#endif
4 changes: 4 additions & 0 deletions src/eckit/cmd/AliasCmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
*/

#include "eckit/cmd/AliasCmd.h"

#include "eckit/cmd/Arg.h"
#include "eckit/cmd/CmdArg.h"
#include "eckit/cmd/CmdParser.h"
#include "eckit/value/Value.h"

//----------------------------------------------------------------------------------------------------------------------

Expand Down
9 changes: 4 additions & 5 deletions src/eckit/cmd/AliasCmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
/// @author Manuel Fuentes
/// @date Jan 1997

#ifndef eckit_cmd_AliasCmd_H
#define eckit_cmd_AliasCmd_H

#pragma once
#include "eckit/cmd/CmdResource.h"

#include <iosfwd>
#include <string>


namespace eckit {

Expand Down Expand Up @@ -52,5 +53,3 @@ class AliasCmd : public CmdResource {
//----------------------------------------------------------------------------------------------------------------------

} // namespace eckit

#endif
1 change: 1 addition & 0 deletions src/eckit/cmd/Arg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "eckit/cmd/Arg.h"

#include <cstddef>
#include <iostream>

namespace eckit {
Expand Down
6 changes: 1 addition & 5 deletions src/eckit/cmd/Arg.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
/// @author Manuel Fuentes
/// @date Jan 1997

#ifndef eckit_cmd_Arg_H
#define eckit_cmd_Arg_H

#pragma once
#include <iosfwd>
#include <memory>
#include <string>
Expand Down Expand Up @@ -90,5 +88,3 @@ class Arg {
//-----------------------------------------------------------------------------

} // namespace eckit

#endif
15 changes: 12 additions & 3 deletions src/eckit/cmd/CmdApplication.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,25 @@
/// @author Florian Rathgeber
/// @date June 2015

#include <unistd.h>
#include <fstream>

#include "eckit/cmd/CmdApplication.h"

#include "eckit/config/Resource.h"
#include "eckit/filesystem/PathName.h"
#include "eckit/io/SockBuf.h"
#include "eckit/log/Channel.h"
#include "eckit/log/CodeLocation.h"
#include "eckit/log/Log.h"
#include "eckit/net/TCPServer.h"
#include "eckit/net/TCPSocket.h"
#include "eckit/runtime/Main.h"
#include "eckit/runtime/Monitor.h"
#include "eckit/types/Types.h"

#include <exception>
#include <fstream>
#include <iostream>
#include <unistd.h>
#include <vector>

namespace eckit {

Expand Down
9 changes: 4 additions & 5 deletions src/eckit/cmd/CmdApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
/// @author Florian Rathgeber
/// @date June 2015

#ifndef eckit_cmd_CmdApplication_H
#define eckit_cmd_CmdApplication_H

#pragma once
#include "eckit/cmd/CmdParser.h"

#include <iosfwd>
#include <string>

namespace eckit {

//----------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -45,5 +46,3 @@ class CmdApplication : public Prompter {
//----------------------------------------------------------------------------------------------------------------------

} // namespace eckit

#endif
6 changes: 6 additions & 0 deletions src/eckit/cmd/CmdArg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@
*/

#include "eckit/cmd/CmdArg.h"

#include "eckit/log/Channel.h"
#include "eckit/log/Log.h"
#include "eckit/utils/Translator.h"
#include "eckit/value/Value.h"

#include <ostream>
#include <utility>

//----------------------------------------------------------------------------------------------------------------------

namespace eckit {
Expand Down
15 changes: 10 additions & 5 deletions src/eckit/cmd/CmdArg.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@
* nor does it submit to any jurisdiction.
*/

#ifndef eckit_cmd_CmdArg_H
#define eckit_cmd_CmdArg_H

#pragma once
#include "eckit/config/Resource.h"
#include "eckit/serialisation/Reanimator.h"
#include "eckit/serialisation/Stream.h"
#include "eckit/serialisation/Streamable.h"
#include "eckit/value/Value.h"

#include <cstddef>
#include <functional>
#include <iosfwd>
#include <map>
#include <string>
#include <vector>

//-----------------------------------------------------------------------------

namespace eckit {
Expand Down Expand Up @@ -115,5 +122,3 @@ class CmdArg : public eckit::Streamable {
//-----------------------------------------------------------------------------

} // namespace eckit

#endif
24 changes: 19 additions & 5 deletions src/eckit/cmd/CmdParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,29 @@
* nor does it submit to any jurisdiction.
*/

#include <cstring>
#include <iomanip>
#include <stack>

#include "eckit/cmd/CmdParser.h"

#include "eckit/cmd/CmdArg.h"
#include "eckit/cmd/CmdResource.h"
#include "eckit/filesystem/PathName.h"
#include "eckit/cmd/UserInput.h"
#include "eckit/exception/Exceptions.h"
#include "eckit/log/Channel.h"
#include "eckit/log/Log.h"
#include "eckit/runtime/Main.h"
#include "eckit/utils/Tokenizer.h"
#include "eckit/value/Value.h"

#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <exception>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <stack>

#define YY_INPUT(buf, result, max_size) \
{ \
Expand Down Expand Up @@ -70,6 +83,7 @@ namespace CmdYacc {
void eckit_cmd_error(const char* msg);

#include "eckit/cmd/cmdsy.c"

int eckit_cmd_wrap(void) {
return 1;
}
Expand Down
9 changes: 2 additions & 7 deletions src/eckit/cmd/CmdParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@
/// @author Florian Rathgeber
/// @date June 2015

#ifndef eckit_cmd_CmdParser_H
#define eckit_cmd_CmdParser_H

#pragma once
#include <iostream>
#include <string>
#include <vector>

#include "eckit/cmd/UserInput.h"

namespace eckit {

class CmdArg;
Expand Down Expand Up @@ -100,5 +97,3 @@ class CmdParser {
//-----------------------------------------------------------------------------

} // namespace eckit

#endif
21 changes: 14 additions & 7 deletions src/eckit/cmd/CmdResource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,31 @@
* nor does it submit to any jurisdiction.
*/

#include <unistd.h>

#include <algorithm>
#include <fstream>
#include <iomanip>
#include "eckit/cmd/CmdResource.h"

#include "eckit/cmd/CmdArg.h"
#include "eckit/cmd/CmdParser.h"
#include "eckit/cmd/CmdResource.h"
#include "eckit/cmd/TermBuf.h"

#include "eckit/config/Resource.h"
#include "eckit/exception/Exceptions.h"
#include "eckit/io/AutoCloser.h"
#include "eckit/io/StdPipe.h"
#include "eckit/io/StdioBuf.h"
#include "eckit/log/Channel.h"
#include "eckit/log/CodeLocation.h"
#include "eckit/log/Log.h"
#include "eckit/os/SignalHandler.h"
#include "eckit/runtime/Monitor.h"
#include "eckit/utils/Tokenizer.h"
#include "eckit/value/Value.h"

#include <algorithm>
#include <cstddef>
#include <exception>
#include <fstream>
#include <iomanip>
#include <unistd.h>
#include <utility>

// TODO: remember to add a mutex

Expand Down
Loading
Loading