Re: [PATCH] compat: expose canonicalize_file_name to C++

Subject: Re: [PATCH] compat: expose canonicalize_file_name to C++

Date: Sat, 17 Apr 2021 09:13:19 -0300

To: Đoàn Trần Công Danh, notmuch@notmuchmail.org

Cc: Đoàn Trần Công Danh

From: David Bremner


Đoàn Trần Công Danh <congdanhqx@gmail.com> writes:

> When compat canonicalize_file_name was introduced, it was limited to
> C code only because it was used by C code only during that time.
>
> From 5ec6fd4d, (lib/open: check for split configuration when creating
> database., 2021-02-16), lib/open.cc, which is C++, relies on the
> existent of canonicalize_file_name.
>
> Let's remove the language restriction to support those platforms don't
> have canonicalize_file_name(3).

Thanks for the patch, but it seems that we need to change some other
things to make this work with C++?

I set HAVE_CANONICALIZE_FILE_NAME = 0 in Makefile.config, and with g++
10.2 on Debian I get

CXX  -g -O2 lib/database.o
In file included from /usr/include/c++/10/cstdlib:75,
                 from /usr/include/c++/10/stdlib.h:36,
                 from ./util/xutil.h:24,
                 from lib/notmuch-private.h:34,
                 from lib/database-private.h:33,
                 from lib/database.cc:21:
/usr/include/stdlib.h:790:14: error: declaration of ‘char* canonicalize_file_name(const char*) throw ()’ has a different exception specifier
  790 | extern char *canonicalize_file_name (const char *__name)
      |              ^~~~~~~~~~~~~~~~~~~~~~
In file included from lib/notmuch-private.h:30,
                 from lib/database-private.h:33,
                 from lib/database.cc:21:
./compat/compat.h:42:1: note: from previous declaration ‘char* canonicalize_file_name(const char*)’
   42 | canonicalize_file_name (const char *path);
      | ^~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile.local:200: lib/database.o] Error 1
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: