necpp icon indicating copy to clipboard operation
necpp copied to clipboard

clang build fails with errors related to '=-' operator

Open jeffsf opened this issue 8 years ago • 0 comments

When attempting a build on Mac OS X 10.11.3 (El Capitan) with current Xcode installed, the format of many assignments is apparently unacceptable to the clang compiler.

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Thread model: posix

The warnings are of the form:

g++ -DHAVE_CONFIG_H -I. -I..    -std=c++11 -O0 -g3 -Wall -Wextra -Werror -DNEC_ERROR_CHECK=1 -g -O2 -MT test_manager-c_geometry.o -MD -MP -MF .deps/test_manager-c_geometry.Tpo -c -o test_manager-c_geometry.o `test -f 'c_geometry.cpp' || echo './'`c_geometry.cpp
c_geometry.cpp:915:5: error: use of unary operator that may be intended as compound assignment (-=) [-Werror]
  zx=- sth;
    ^~
c_geometry.cpp:1094:10: error: use of unary operator that may be intended as compound assignment (-=) [-Werror]
    z[nx]=- e1;
         ^~

and continue until the compiler gives up.

As I'm as puzzled as clang is as to the intent of these lines, I looked at the source code obtained from [http://qsl.net/4nec2/Nec2dXS_src.zip]

It appears that this '=-' is a hold-over from FORTRAN such as ZX=-STH

jeffsf avatar Mar 16 '16 21:03 jeffsf