On 2021-04-17 09:13:19-0300, David Bremner <david@tethera.net> wrote: > Đ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); > | ^~~~~~~~~~~~~~~~~~~~~~ Sorry, I forgot to test this change in a glibc system. I'm not really sure how to workaround this since other systems may have canonicalize_file_name(3) with different signature, let's say with or without noexcept, throw(). However, I see that lib/open.cc uses g_key_file_get_value from GLib already, we may switch to g_canonicalize_file_name then? -- Danh _______________________________________________ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-leave@notmuchmail.org