Skip to content

Commit

Permalink
Move model instances into one source file, so they get initialized in…
Browse files Browse the repository at this point in the history
… the correct order.
  • Loading branch information
Chris Dodd committed Apr 12, 2017
1 parent 464cb9b commit 26b4b6d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
3 changes: 1 addition & 2 deletions frontends/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ p4_frontend_UNIFIED = \
frontends/p4/evaluator/substituteParameters.cpp \
frontends/p4/parserControlFlow.cpp \
frontends/p4/reservedWords.cpp \
frontends/p4/coreLibrary.cpp \
frontends/p4/modelInstances.cpp \
frontends/p4/externInstance.cpp \
frontends/p4/methodInstance.cpp \
frontends/p4/parserCallGraph.cpp \
Expand All @@ -40,7 +40,6 @@ p4_frontend_UNIFIED = \
frontends/p4/substitution.cpp \
frontends/p4/substitutionVisitor.cpp \
frontends/p4/fromv1.0/programStructure.cpp \
frontends/p4/fromv1.0/v1model.cpp \
frontends/p4/fromv1.0/converters.cpp \
frontends/p4/typeMap.cpp \
frontends/p4/simplifyDefUse.cpp \
Expand Down
23 changes: 0 additions & 23 deletions frontends/p4/fromv1.0/v1model.cpp

This file was deleted.

10 changes: 10 additions & 0 deletions frontends/p4/coreLibrary.cpp → frontends/p4/modelInstances.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,19 @@ limitations under the License.
*/

#include "coreLibrary.h"
#include "fromv1.0/v1model.h"

namespace P4 {

P4CoreLibrary P4CoreLibrary::instance;

} // namespace P4

/* These must be in the same compiliation unit to ensure that P4CoreLibrary::instance
* is initialized before V1Model::instance */
namespace P4V1 {

V1Model V1Model::instance;

} // namespace P4V1

0 comments on commit 26b4b6d

Please sign in to comment.