Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing #include <algorithm> for std::min/std::max uses, … #7624

Merged
merged 1 commit into from Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion include/flatbuffers/buffer.h
Expand Up @@ -17,6 +17,8 @@
#ifndef FLATBUFFERS_BUFFER_H_
#define FLATBUFFERS_BUFFER_H_

#include <algorithm>

#include "flatbuffers/base.h"

namespace flatbuffers {
Expand Down Expand Up @@ -149,4 +151,4 @@ template<typename T> const T *GetSizePrefixedRoot(const void *buf) {

} // namespace flatbuffers

#endif // FLATBUFFERS_BUFFER_H_
#endif // FLATBUFFERS_BUFFER_H_
1 change: 1 addition & 0 deletions include/flatbuffers/flatbuffer_builder.h
Expand Up @@ -17,6 +17,7 @@
#ifndef FLATBUFFERS_FLATBUFFER_BUILDER_H_
#define FLATBUFFERS_FLATBUFFER_BUILDER_H_

#include <algorithm>
#include <functional>
#include <initializer_list>

Expand Down
2 changes: 2 additions & 0 deletions include/flatbuffers/flatbuffers.h
Expand Up @@ -17,6 +17,8 @@
#ifndef FLATBUFFERS_H_
#define FLATBUFFERS_H_

#include <algorithm>

// TODO: These includes are for mitigating the pains of users editing their
// source because they relied on flatbuffers.h to include everything for them.
#include "flatbuffers/array.h"
Expand Down
1 change: 1 addition & 0 deletions include/flatbuffers/flexbuffers.h
Expand Up @@ -17,6 +17,7 @@
#ifndef FLATBUFFERS_FLEXBUFFERS_H_
#define FLATBUFFERS_FLEXBUFFERS_H_

#include <algorithm>
#include <map>
// Used to select STL variant.
#include "flatbuffers/base.h"
Expand Down
1 change: 1 addition & 0 deletions include/flatbuffers/idl.h
Expand Up @@ -17,6 +17,7 @@
#ifndef FLATBUFFERS_IDL_H_
#define FLATBUFFERS_IDL_H_

#include <algorithm>
#include <functional>
#include <map>
#include <memory>
Expand Down
1 change: 1 addition & 0 deletions include/flatbuffers/util.h
Expand Up @@ -31,6 +31,7 @@
# include <stdio.h>
#endif // FLATBUFFERS_PREFER_PRINTF

#include <limits>
#include <string>

namespace flatbuffers {
Expand Down
2 changes: 2 additions & 0 deletions include/flatbuffers/vector_downward.h
Expand Up @@ -17,6 +17,8 @@
#ifndef FLATBUFFERS_VECTOR_DOWNWARD_H_
#define FLATBUFFERS_VECTOR_DOWNWARD_H_

#include <algorithm>

#include "flatbuffers/base.h"
#include "flatbuffers/default_allocator.h"
#include "flatbuffers/detached_buffer.h"
Expand Down
1 change: 1 addition & 0 deletions src/annotated_binary_text_gen.cpp
@@ -1,5 +1,6 @@
#include "annotated_binary_text_gen.h"

#include <algorithm>
#include <sstream>
#include <string>

Expand Down
3 changes: 2 additions & 1 deletion src/binary_annotator.cpp
@@ -1,5 +1,6 @@
#include "binary_annotator.h"

#include <algorithm>
#include <limits>
#include <string>
#include <vector>
Expand Down Expand Up @@ -1416,4 +1417,4 @@ bool BinaryAnnotator::ContainsSection(const uint64_t offset) {
it->second.regions.back().length;
}

} // namespace flatbuffers
} // namespace flatbuffers
2 changes: 2 additions & 0 deletions src/flatc.cpp
Expand Up @@ -16,6 +16,8 @@

#include "flatbuffers/flatc.h"

#include <algorithm>
#include <limits>
#include <list>
#include <sstream>

Expand Down
1 change: 1 addition & 0 deletions src/idl_gen_cpp.cpp
Expand Up @@ -16,6 +16,7 @@

// independent from idl_parser, since this code is not needed for most clients

#include <limits>
#include <string>
#include <unordered_set>

Expand Down
1 change: 1 addition & 0 deletions src/idl_gen_go.cpp
Expand Up @@ -16,6 +16,7 @@

// independent from idl_parser, since this code is not needed for most clients

#include <algorithm>
#include <sstream>
#include <string>

Expand Down
2 changes: 2 additions & 0 deletions src/idl_gen_json_schema.cpp
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

#include <algorithm>
#include <iostream>
#include <limits>

#include "flatbuffers/code_generators.h"
#include "flatbuffers/idl.h"
Expand Down
2 changes: 2 additions & 0 deletions src/idl_gen_text.cpp
Expand Up @@ -16,6 +16,8 @@

// independent from idl_parser, since this code is not needed for most clients

#include <algorithm>

#include "flatbuffers/flatbuffers.h"
#include "flatbuffers/flexbuffers.h"
#include "flatbuffers/idl.h"
Expand Down
4 changes: 3 additions & 1 deletion tests/flexbuffers_test.cpp
@@ -1,3 +1,5 @@
#include <limits>

#include "flexbuffers_test.h"

#include "flatbuffers/flexbuffers.h"
Expand Down Expand Up @@ -289,4 +291,4 @@ void ParseFlexbuffersFromJsonWithNullTest() {
}

} // namespace tests
} // namespace flatbuffers
} // namespace flatbuffers
4 changes: 3 additions & 1 deletion tests/fuzz_test.cpp
@@ -1,3 +1,5 @@
#include <algorithm>

#include "fuzz_test.h"

#include "flatbuffers/flatbuffers.h"
Expand Down Expand Up @@ -302,4 +304,4 @@ void FuzzTest2() {
}

} // namespace tests
} // namespace flatbuffers
} // namespace flatbuffers
3 changes: 2 additions & 1 deletion tests/monster_test.cpp
@@ -1,5 +1,6 @@
#include "monster_test.h"

#include <limits>
#include <vector>

#include "flatbuffers/flatbuffer_builder.h"
Expand Down Expand Up @@ -852,4 +853,4 @@ void UnPackTo(const uint8_t *flatbuf) {
}

} // namespace tests
} // namespace flatbuffers
} // namespace flatbuffers
1 change: 1 addition & 0 deletions tests/parser_test.cpp
@@ -1,6 +1,7 @@
#include "parser_test.h"

#include <cmath>
#include <limits>
#include <string>

#include "flatbuffers/idl.h"
Expand Down
1 change: 1 addition & 0 deletions tests/test.cpp
Expand Up @@ -16,6 +16,7 @@
#include <stdint.h>

#include <cmath>
#include <limits>
#include <memory>
#include <string>

Expand Down