use c++ for some more sources

Do a (superficial) port to c++ of some of the c sources. Update
deps. Fix a few compiler warnings.
This commit is contained in:
Dirk-Jan C. Binnema 2020-11-07 14:06:23 +02:00
parent d94f685c89
commit a1d1619bda
22 changed files with 82 additions and 89 deletions

View File

@ -35,6 +35,13 @@ AM_CFLAGS= \
-Wno-missing-prototypes \
-Wno-missing-declarations
AM_CXXFLAGS= \
$(ASAN_CFLAGS) \
${WARN_CXXFLAGS} \
-Wno-redundant-decls \
-Wno-missing-declarations \
-Wno-suggest-attribute=noreturn
lib_LTLIBRARIES= \
libguile-mu.la
@ -45,6 +52,7 @@ libguile_mu_la_SOURCES= \
mu-guile-message.hh
libguile_mu_la_CFLAGS=$(AM_CFLAGS)
libguile_mu_la_CXXFLAGS=$(AM_CXXFLAGS)
libguile_mu_la_LIBADD= \
${top_builddir}/lib/libmu.la \
@ -67,12 +75,14 @@ mu_guile_TEXINFOS= \
BUILT_SOURCES=$(XFILES)
snarfcppopts= $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
snarfcopts= $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
snarfcxxopts= $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
SUFFIXES = .x .doc
.c.x:
$(AM_V_GEN) $(GUILE_SNARF) -o $@ $< $(snarfcppopts)
$(AM_V_GEN) $(GUILE_SNARF) -o $@ $< $(snarfcopts)
.cc.x:
$(AM_V_GEN) $(GUILE_SNARF) -o $@ $< $(snarfcppopts)
$(AM_V_GEN) $(GUILE_SNARF) -o $@ $< $(snarfcxxopts)
# FIXME: GUILE_SITEDIR would be better, but that

View File

@ -27,7 +27,7 @@
#include "mu-guile.hh"
#include <mu-runtime.h>
#include <mu-runtime.hh>
#include <mu-store.hh>
#include <mu-query.hh>
#include <mu-msg.h>

View File

@ -28,7 +28,7 @@
#include <libguile.h>
#pragma GCC diagnostic pop
#include <mu-runtime.h>
#include <mu-runtime.hh>
#include <mu-store.hh>
#include <mu-query.hh>
#include <mu-msg.h>

View File

@ -59,17 +59,36 @@ noinst_LTLIBRARIES= \
libmu.la
libmu_la_SOURCES= \
mu-bookmarks.c \
mu-bookmarks.h \
mu-bookmarks.cc \
mu-bookmarks.hh \
mu-contacts.cc \
mu-contacts.hh \
mu-container.cc \
mu-container.hh \
mu-data.hh \
mu-parser.cc \
mu-parser.hh \
mu-query.cc \
mu-query.hh \
mu-runtime.cc \
mu-runtime.hh \
mu-script.cc \
mu-script.hh \
mu-server.cc \
mu-server.hh \
mu-store.cc \
mu-store.hh \
mu-threader.cc \
mu-threader.hh \
mu-tokenizer.cc \
mu-tokenizer.hh \
mu-tree.hh \
mu-xapian.cc \
mu-xapian.hh \
mu-flags.c \
mu-flags.h \
mu-maildir.c \
mu-maildir.h \
mu-flags.h \
mu-msg-crypto.c \
mu-msg-doc.cc \
mu-msg-doc.h \
@ -86,27 +105,7 @@ libmu_la_SOURCES= \
mu-msg-priv.h \
mu-msg-sexp.cc \
mu-msg.c \
mu-msg.h \
mu-msg.h \
mu-parser.cc \
mu-parser.hh \
mu-query.cc \
mu-query.hh \
mu-runtime.cc \
mu-runtime.h \
mu-script.c \
mu-script.h \
mu-server.cc \
mu-server.hh \
mu-store.cc \
mu-store.hh \
mu-threader.cc \
mu-threader.hh \
mu-tokenizer.cc \
mu-tokenizer.hh \
mu-tree.hh \
mu-xapian.cc \
mu-xapian.hh
mu-msg.h
libmu_la_LIBADD= \
$(XAPIAN_LIBS) \

View File

@ -1,6 +1,5 @@
/* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/
/*
** Copyright (C) 2010-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** Copyright (C) 2010-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
@ -19,11 +18,11 @@
*/
#include <glib.h>
#include "mu-bookmarks.h"
#include "mu-bookmarks.hh"
#define MU_BOOKMARK_GROUP "mu"
struct _MuBookmarks {
struct MuBookmarks {
char *_bmpath;
GHashTable *_hash;
};
@ -113,7 +112,7 @@ mu_bookmarks_lookup (MuBookmarks *bm, const gchar *name)
g_return_val_if_fail (bm, NULL);
g_return_val_if_fail (name, NULL);
return g_hash_table_lookup (bm->_hash, name);
return (const char*)g_hash_table_lookup (bm->_hash, name);
}
struct _BMData {

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2008-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** Copyright (C) 2008-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
@ -17,23 +17,20 @@
**
*/
#ifndef __MU_BOOKMARKS_H__
#define __MU_BOOKMARKS_H__
#ifndef MU_BOOKMARKS_HH__
#define MU_BOOKMARKS_HH__
#include <glib.h>
G_BEGIN_DECLS
/**
* @addtogroup MuBookmarks
* Functions for dealing with bookmarks
* @{
*/
struct _MuBookmarks;
/*! \struct MuBookmarks
* \brief Opaque structure representing a sequence of bookmarks
*/
typedef struct _MuBookmarks MuBookmarks;
struct MuBookmarks;
/**
@ -81,6 +78,4 @@ void mu_bookmarks_foreach (MuBookmarks *bm, MuBookmarksForeachFunc func,
/** @} */
G_END_DECLS
#endif /*__MU_BOOKMARKS_H__*/

View File

@ -1,6 +1,5 @@
/* -*- mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
**
** Copyright (C) 2012-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
/*
** Copyright (C) 2012-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2019 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** Copyright (C) 2019-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
@ -17,7 +17,7 @@
**
*/
#include "mu-runtime.h"
#include "mu-runtime.hh"
#include "utils/mu-util.h"
#include "utils/mu-logger.hh"

View File

@ -17,9 +17,7 @@
**
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif /*HAVE_CONFIG_H*/
#ifdef BUILD_GUILE
@ -37,14 +35,14 @@
#include <unistd.h>
#include "utils/mu-str.h"
#include "mu-script.h"
#include "mu-script.hh"
#include "utils/mu-util.h"
/**
* Structure with information about a certain script.
* the values will be *freed* when MuScriptInfo is freed
*/
struct _MuScriptInfo {
struct MuScriptInfo {
char *_name; /* filename-sans-extension */
char *_path; /* full path to script */
char *_oneline; /* one-line description */
@ -121,15 +119,17 @@ mu_script_info_matches_regex (MuScriptInfo *msi, const char *rxstr,
g_return_val_if_fail (msi, FALSE);
g_return_val_if_fail (rxstr, FALSE);
rx = g_regex_new (rxstr, G_REGEX_CASELESS|G_REGEX_OPTIMIZE, 0, err);
rx = g_regex_new (rxstr,
(GRegexCompileFlags)(G_REGEX_CASELESS|G_REGEX_OPTIMIZE),
(GRegexMatchFlags)0, err);
if (!rx)
return FALSE;
match = FALSE;
if (msi->_name)
match = g_regex_match (rx, msi->_name, 0, NULL);
match = g_regex_match (rx, msi->_name, (GRegexMatchFlags)0, NULL);
if (!match && msi->_oneline)
match = g_regex_match (rx, msi->_oneline, 0, NULL);
match = g_regex_match (rx, msi->_oneline,(GRegexMatchFlags)0, NULL);
return match;
}

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2012-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** Copyright (C) 2012-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
@ -17,16 +17,13 @@
**
*/
#ifndef __MU_SCRIPT_H__
#define __MU_SCRIPT_H__
#ifndef MU_SCRIPT_HH__
#define MU_SCRIPT_HH__
#include <glib.h>
G_BEGIN_DECLS
/* Opaque structure with information about a script */
struct _MuScriptInfo;
typedef struct _MuScriptInfo MuScriptInfo;
struct MuScriptInfo;
/**
* get the name of the script (sans-extension, if some extension was
@ -127,6 +124,4 @@ MuScriptInfo* mu_script_find_script_with_name (GSList *lst, const char *name);
gboolean mu_script_guile_run (MuScriptInfo *msi, const char *muhome,
const char **args, GError **err);
G_END_DECLS
#endif /*__MU_SCRIPT_H__*/
#endif /*MU_SCRIPT_HH__*/

View File

@ -35,7 +35,7 @@
#include <glib/gprintf.h>
#include "mu-msg.h"
#include "mu-runtime.h"
#include "mu-runtime.hh"
#include "mu-maildir.h"
#include "mu-query.hh"
#include "index/mu-indexer.hh"

View File

@ -27,7 +27,7 @@
#include "mu-cmd.hh"
#include "mu-contacts.hh"
#include "mu-runtime.h"
#include "mu-runtime.hh"
#include "utils/mu-util.h"
#include "utils/mu-utils.hh"

View File

@ -32,8 +32,8 @@
#include "mu-maildir.h"
#include "mu-query.hh"
#include "mu-msg-iter.h"
#include "mu-bookmarks.h"
#include "mu-runtime.h"
#include "mu-bookmarks.hh"
#include "mu-runtime.hh"
#include "utils/mu-util.h"
#include "utils/mu-str.h"

View File

@ -33,7 +33,7 @@
#include "mu-msg.h"
#include "index/mu-indexer.hh"
#include "mu-store.hh"
#include "mu-runtime.h"
#include "mu-runtime.hh"
#include "utils/mu-util.h"

View File

@ -1,7 +1,5 @@
/* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/
/*
** Copyright (C) 2012-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** Copyright (C) 2012-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
@ -30,8 +28,8 @@
#include <errno.h>
#include "mu-cmd.hh"
#include "mu-script.h"
#include "mu-runtime.h"
#include "mu-script.hh"
#include "mu-runtime.hh"
#include "utils/mu-util.h"

View File

@ -24,7 +24,7 @@
#include <atomic>
#include <unistd.h>
#include "mu-runtime.h"
#include "mu-runtime.hh"
#include "mu-cmd.hh"
#include "mu-server.hh"

View File

@ -34,7 +34,7 @@
#include "mu-cmd.hh"
#include "mu-maildir.h"
#include "mu-contacts.hh"
#include "mu-runtime.h"
#include "mu-runtime.hh"
#include "mu-flags.h"
#include "utils/mu-util.h"

View File

@ -25,7 +25,7 @@
#include "mu-config.hh"
#include "mu-cmd.hh"
#include "mu-runtime.h"
#include "mu-runtime.hh"
#include "utils/mu-utils.hh"
using namespace Mu;

View File

@ -1,4 +1,4 @@
## Copyright (C) 2008-2019 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
## Copyright (C) 2008-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@ -35,7 +35,7 @@ AM_CFLAGS= \
-Wno-deprecated-declarations \
-Wno-switch-enum
AM_CXXFLAGS=$(AM_CFLAGS) $(WARN_CXXFLAGS)
AM_CXXFLAGS=$(WARN_CXXFLAGS)
#
# Distributors: this is a _toy_, not for distribution. the "noinst_" says enough
@ -44,17 +44,15 @@ noinst_PROGRAMS= \
mug
mug_SOURCES= \
mug.c \
mug.cc \
mug-msg-list-view.cc \
mug-msg-list-view.h \
mug-msg-view.h \
mug-msg-view.c \
mug-query-bar.h \
mug-query-bar.c \
mug-shortcuts.c \
mug-shortcuts.h \
dummy.cc
mug-shortcuts.cc \
mug-shortcuts.h
DISTCLEANFILES= \
$(BUILT_SOURCES)

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** Copyright (C) 2010-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
@ -18,7 +18,7 @@
*/
#include "mug-shortcuts.h"
#include "mu-bookmarks.h"
#include "mu-bookmarks.hh"
/* include other impl specific header files */
@ -58,7 +58,7 @@ mug_shortcuts_class_init (MugShortcutsClass * klass)
GObjectClass *gobject_class;
gobject_class = (GObjectClass *) klass;
parent_class = g_type_class_peek_parent (klass);
parent_class = (GtkBoxClass*)g_type_class_peek_parent (klass);
gobject_class->finalize = mug_shortcuts_finalize;
g_type_class_add_private (gobject_class, sizeof (MugShortcutsPrivate));

View File

@ -25,7 +25,7 @@
#include <utils/mu-util.h>
#include <mu-store.hh>
#include <mu-runtime.h>
#include <mu-runtime.hh>
#include "mug-msg-list-view.h"
#include "mug-query-bar.h"