octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: c22219b8a6a6 throws an error on Mac OS X


From: Ben Abbott
Subject: Re: c22219b8a6a6 throws an error on Mac OS X
Date: Sun, 03 Jan 2016 08:16:56 -0500

> On Jan 2, 2016, at 10:04 PM, Rik <address@hidden> wrote:
> 
> On 01/02/2016 06:05 PM, Ben Abbott wrote:
>>> On Jan 2, 2016, at 20:55, Rik <address@hidden> wrote:
>>> 
>>>> On 01/02/2016 01:28 PM, Ben Abbott wrote:
>>>> Rik,
>>>> 
>>>> Your recent changeset c22219b8a6a6 throws an error for Mac OS X.
>>>> 
>>>> In file included from libinterp/octave.cc:72:
>>>> In file included from ./libinterp/octave-value/ov-range.h:41:
>>>> In file included from ./libinterp/octave-value/ov-re-mat.h:38:
>>>> ./libinterp/octave-value/ov-base-mat.h:97:8: warning: 
>>>> 'octave_base_matrix<NDArray>::assign' hides overloaded virtual function 
>>>> [-Woverloaded-virtual]
>>>> void assign (const octave_value_list& idx, typename MT::element_type rhs);
>>>>      ^
>>>> ./libinterp/octave-value/ov-base.h:278:16: note: hidden overloaded virtual 
>>>> function 'octave_base_value::assign' declared here: type mismatch at 1st 
>>>> parameter ('const std::string &'
>>>>     (aka 'const basic_string<char, char_traits<char>, allocator<char> > 
>>>> &') vs 'const octave_value_list &')
>>>> virtual void assign (const std::string&, const octave_value&) { }
>>>>              ^
>>>> libinterp/octave.cc:484:3: error: no matching function for call to 
>>>> 'set_liboctave_error_handler'
>>>> set_liboctave_error_handler (lo_error_handler);
>>>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> ./liboctave/cruft/misc/lo-error.h:56:23: note: candidate function not 
>>>> viable: no known conversion from 'void (const char *, ...)' to 
>>>> 'liboctave_error_handler' (aka
>>>>     'void (*)(const char *, ...) __attribute__((noreturn))') for 1st 
>>>> argument
>>>> CRUFT_API extern void set_liboctave_error_handler (liboctave_error_handler 
>>>> f);
>>>>                     ^
>>>> libinterp/octave.cc:485:3: error: no matching function for call to 
>>>> 'set_liboctave_error_with_id_handler'
>>>> set_liboctave_error_with_id_handler (lo_error_with_id_handler);
>>>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> ./liboctave/cruft/misc/lo-error.h:58:23: note: candidate function not 
>>>> viable: no known conversion from 'void (const char *, const char *, ...)' 
>>>> to 'liboctave_error_with_id_handler'
>>>>     (aka 'void (*)(const char *, const char *, ...) 
>>>> __attribute__((noreturn))') for 1st argument
>>>> CRUFT_API extern void set_liboctave_error_with_id_handler 
>>>> (liboctave_error_with_id_handler f);
>>>>                     ^
>>>> 2 warnings and 2 errors generated.
>>>> Makefile:18032: recipe for target 
>>>> 'libinterp/libinterp_liboctinterp_la-octave.lo' failed
>>>> make[2]: *** [libinterp/libinterp_liboctinterp_la-octave.lo] Error 1
>>>> make[2]: Leaving directory 
>>>> '/Users/bpabbott/Development/mercurial/default/sources'
>>>> Makefile:25846: recipe for target 'all-recursive' failed
>>>> make[1]: *** [all-recursive] Error 1
>>>> make[1]: Leaving directory 
>>>> '/Users/bpabbott/Development/mercurial/default/sources'
>>>> Makefile:9937: recipe for target 'all' failed
>>>> make: *** [all] Error 2
>>> Are you using clang or gcc?  And if gcc, what version?
>>> 
>>> --Rik
>> Clang ... Apple's version.
> 
> So there's a problem.  The GCC_ATTR_NORETURN is only supposed to be used if
> you are compiling with gcc.  The code is in oct-conf-post.h.
> 
> #if defined (__GNUC__)
> #define GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__))
> #define HAVE_ATTR_DEPRECATED
> 
> #define GCC_ATTR_NORETURN __attribute__ ((__noreturn__))
> #define HAVE_ATTR_NORETURN
> 
> You could check whether __GNUC__ is really defined by adding
> 
> #if defined (__GNUC__)
> #error __GNUC__ is defined, but I'm not GCC!
> #endif
> 
> to some file and then trying to run a compile.  It should error out during
> the compile with the error message.
> 
> I really wish clang would not pretend to be gcc, but this seems to have
> been reported in other places.  See
> http://clang-developers.42468.n3.nabble.com/Disable-GNU-defines-in-Clang-td4030764.html
> and
> http://stackoverflow.com/questions/28166565/detect-gcc-as-opposed-to-msvc-clang-with-macro.
>  
> I'm CC'ing the Octave-Maintainer's list because this appears to be only the
> tip of the iceberg.  We don't use __GNUC__ too frequently, but maybe we
> need to rework each instance where it is used and start checking in
> addition for __clang__.  Or maybe we should be using #undef __GNUC__ just
> once when __clang__ is detected.  I don't really know.
> 
> —Rik

Thanks Rik. I added the lines below to lo-error.h ...

#if defined (__GNUC__) && defined (__clang__)
#error __GNUC__ is defined, but I'm clang!
#endif

… and got the expected result during make.

  CXX      libinterp/dldfcn/libinterp_dldfcn___delaunayn___la-__delaunayn__.lo
In file included from libinterp/dldfcn/__delaunayn__.cc:50:
In file included from libinterp/corefcn/Cell.h:29:
In file included from ./liboctave/array/Array.h:35:
In file included from ./liboctave/array/dim-vector.h:33:
./liboctave/cruft/misc/lo-error.h:31:2: error: __GNUC__ is defined, but I'm 
clang!
#error __GNUC__ is defined, but I'm clang!
 ^
libinterp/dldfcn/__delaunayn__.cc:193:19: warning: use of old-style cast 
[-Wold-style-cast]
                  FOREACHvertex_ (facet->vertices)
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/sw/include/libqhull/libqhull.h:912:34: note: expanded from macro 
'FOREACHvertex_'
#define FOREACHvertex_(vertices) FOREACHsetelement_(vertexT, vertices,vertex)
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/sw/include/libqhull/qset.h:137:24: note: expanded from macro 
'FOREACHsetelement_'
          variable##p= (type **)&((set)->e[0].p); \
                       ^        ~~~~~~~~~~~~~~~~
1 warning and 1 error generated.

Next, I modified oct-conf-post.in.h as below ...

$ hg diff
diff --git a/oct-conf-post.in.h b/oct-conf-post.in.h
--- a/oct-conf-post.in.h
+++ b/oct-conf-post.in.h
@@ -24,7 +24,7 @@ along with Octave; see the file COPYING.
 #define GNULIB_NAMESPACE gnulib
 #endif
 
-#if defined (__GNUC__)
+#if defined (__GNUC__) && ! defined (__clang__)
 #define GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__))
 #define HAVE_ATTR_DEPRECATED

… and was able to build Octave. My tip is ...

$ hg tip
changeset:   21026:5a340d8458d6
bookmark:    @
tag:         tip
user:        Rik <address@hidden>
date:        Sat Jan 02 10:28:59 2016 -0800
summary:     maint: Alphabetize list of gripes.

Ben


reply via email to

[Prev in Thread] Current Thread [Next in Thread]