Skip to content

Commit

Permalink
Fix circular dependency in fixed_function.h (#350)
Browse files Browse the repository at this point in the history
* Include fixed_function at top of test file

This will trigger compilation errors under the current setup due
to the recursive dependency; moving it here should allow us to
detect if this issue rears its head again in the future.

* Limit inclusion of functional.h by utility.h

A circular dependency was forming when function_detail.h was
included ahead of function.h, which could occur if a user included
fixed_function.h prior to functional.h.

As utility.h only requires the type traits for
eastl::reference_wrapper, this limits the inclusion to only
attempting to pull them in instead of the entirety of functional.h.

This may break users who depend upon utility.h pulling in functional.h.

* Reorder test includes per review comments

Added a link to the issue to document the ordering as well, so
it's a bit clearer for anyone 3 years down the line.
  • Loading branch information
Meorawr authored Apr 13, 2020
1 parent 38e2811 commit 73e1685
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/EASTL/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <EASTL/internal/config.h>
#include <EASTL/type_traits.h>
#include <EASTL/iterator.h>
#include <EASTL/functional.h>
#include <EASTL/internal/functional_base.h>
#include <EASTL/internal/move_help.h>
#include <EABase/eahave.h>

Expand Down
6 changes: 5 additions & 1 deletion test/source/TestFixedFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

#include <EABase/eabase.h>
#include <EAAssert/eaassert.h>
#include "EASTLTest.h"

// Included prior to EASTLTest.h to guard against the following bug resurfacing:
// https://github.com/electronicarts/EASTL/issues/275
#include <EASTL/fixed_function.h>

#include "EASTLTest.h"
#include <EASTL/numeric.h>

EA_DISABLE_ALL_VC_WARNINGS()
Expand Down

0 comments on commit 73e1685

Please sign in to comment.