GobySoft / dccl

Dynamic Compact Control Language
Other
17 stars 13 forks source link

Fix/mac compilation #1

Closed nknotts closed 8 years ago

nknotts commented 9 years ago

I had to remove the using phoenix::ref statement to fix compilation on OSX 10.11 w/clang 7.

I also added a few common entries to gitignore to keep my build clean.

.DS_Store is a file that OS X likes to add to every directory. *.swp are temporary files created by vim while editing CMakeLists.txt.user is the project file used by qtcreator (my IDE of choice)

Also, clang gave me a few warnings.

In file included from dccl/src/arithmetic/field_codec_arithmetic.cpp:24:
dccl/src/arithmetic/field_codec_arithmetic.h:212:91: warning: operator '<<' has lower precedence than '-'; '-' will be evaluated
      first [-Wshift-op-parentheses]
              static const uint64 HALF = (static_cast<uint64>(1) << Model::CODE_VALUE_BITS-1);        // 10000000...
                                                                 ~~ ~~~~~~~~~~~~~~~~~~~~~~^~
dccl/src/arithmetic/field_codec_arithmetic.h:212:91: note: place parentheses around the '-' expression to silence this warning
              static const uint64 HALF = (static_cast<uint64>(1) << Model::CODE_VALUE_BITS-1);        // 10000000...
In file included from dccl/src/apps/pb_plugin/pb_plugin.cpp:31:
dccl/src/apps/pb_plugin/gen_units_class_plugin.h:142:70: warning: | has lower precedence than >; > will be evaluated first
      [-Wparentheses]
                                    ('^' > double_[push_back(phoenix::ref(base_dim_powers), _1)] | eps[push_back(phoenix::ref(base_dim_powers), 1)])),
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
dccl/src/apps/pb_plugin/gen_units_class_plugin.h:142:70: note: place parentheses around the '>' expression to silence this warning
                                    ('^' > double_[push_back(phoenix::ref(base_dim_powers), _1)] | eps[push_back(phoenix::ref(base_dim_powers), 1)])),
                                                                                                 ^
                                     (                                                          )
dccl/src/apps/pb_plugin/gen_units_class_plugin.h:142:70: note: place parentheses around the | expression to evaluate it first
                                    ('^' > double_[push_back(phoenix::ref(base_dim_powers), _1)] | eps[push_back(phoenix::ref(base_dim_powers), 1)])),

These can probably be safely ignored but I just wanted to make sure the code is doing what you intend.

tsaubergine commented 8 years ago

Thanks, this is good.

Both of those warnings are evaluating the correct operator, but you might as well make them go away. Could you add the extra parentheses, check that this compiles on your setup and commit to your branch and I will complete the merge.

I think it should be:

static const uint64 HALF = (static_cast<uint64>(1) << (Model::CODE_VALUE_BITS-1));

and

(('^' > double_[push_back(phoenix::ref(base_dim_powers), _1)]) | eps[push_back(phoenix::ref(base_dim_powers), 1)])),
nknotts commented 8 years ago

Compilation on OSX 10.11.1/clang 7 is now warning free.