unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3)
@ 2021-12-11 21:32 dick.r.chiang
  2021-12-12  6:12 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: dick.r.chiang @ 2021-12-11 21:32 UTC (permalink / raw)
  To: 52440

[-- Attachment #1: Type: text/plain, Size: 81 bytes --]


More cleanly separate the new module from standard builds, aka,
slow thy roll.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-sqlite3-Quis-custodiet-ipsos-custodes.patch --]
[-- Type: text/x-diff, Size: 14051 bytes --]

From c7b20a867b795d0ebfa6d5572c31a72f3caa926a Mon Sep 17 00:00:00 2001
From: dickmao <dick.r.chiang@gmail.com>
Date: Sat, 11 Dec 2021 16:21:30 -0500
Subject: [PATCH] [sqlite3] Quis custodiet ipsos custodes

* configure.ac (WIDE_EMACS_INT): Default off `--with-sqlite3`.
(HAVE_SQLITE3): Opt out of sqlite.o.
(SQLITE3_LIBS): Hew to autotools sop.
* lisp/sqlite-mode.el (sqlite-execute, sqlite-more-p,
sqlite-next, sqlite-columns, sqlite-finalize,
sqlite-select, sqlite-open): Forward declare.
* src/Makefile.in (SQLITE3_CFLAGS): Hew to autotools sop.
* src/alloc.c (union emacs_align_type): Give a hoot,
don't pollute.
(cleanup_vector): Give a hoot, don't pollute.
* src/data.c (syms_of_data): Fence.
* src/emacs.c (main): Give a hoot, don't pollute.
* src/lisp.h (GCALIGNED_STRUCT): Give a hoot, don't pollute.
* src/print.c (print_vectorlike): Fence.
* src/sqlite.c (Fsqlitep): What is SQLITE without the P?
(Fsqlite_available_p): Unfence.
(syms_of_sqlite): Unfence.
* test/src/sqlite-tests.el (sqlite-mode, sqlite-execute,
sqlite-close, sqlitep, sqlite-available-p, sqlite-finalize,
sqlite-next, sqlite-more-p, sqlite-select, sqlite-open):
Forward declare.
---
 configure.ac             | 21 ++++++++------
 lisp/sqlite-mode.el      |  8 ++++++
 src/Makefile.in          | 12 ++++++--
 src/alloc.c              | 11 +++++++-
 src/data.c               |  1 +
 src/emacs.c              |  8 +++++-
 src/lisp.h               | 36 ------------------------
 src/print.c              |  7 ++++-
 src/sqlite.c             | 18 ++----------
 src/sqlite.h             | 59 ++++++++++++++++++++++++++++++++++++++++
 test/Makefile.in         |  1 -
 test/src/sqlite-tests.el | 11 ++++++++
 12 files changed, 127 insertions(+), 66 deletions(-)
 create mode 100644 src/sqlite.h

diff --git a/configure.ac b/configure.ac
index 0debc852141..a602e45cefe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -448,7 +448,7 @@ AC_DEFUN
 OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
 OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])
 OPTION_DEFAULT_ON([webp],[don't compile with WebP image support])
-OPTION_DEFAULT_ON([sqlite3],[don't compile with sqlite3 support])
+OPTION_DEFAULT_OFF([sqlite3],[don't compile with sqlite3 support])
 OPTION_DEFAULT_ON([lcms2],[don't compile with Little CMS support])
 OPTION_DEFAULT_ON([libsystemd],[don't compile with libsystemd support])
 OPTION_DEFAULT_ON([cairo],[don't compile with Cairo drawing])
@@ -2682,27 +2682,32 @@ AC_DEFUN
    fi
 fi
 
-### Use -lsqlite3 if available, unless '--with-sqlite3=no'
 HAVE_SQLITE3=no
+SQLITE3_OBJ=
+### Use -lsqlite3 if available, unless '--with-sqlite3=no'
 if test "${with_sqlite3}" != "no"; then
    AC_CHECK_LIB(sqlite3, sqlite3_open_v2, HAVE_SQLITE3=yes, HAVE_SQLITE3=no)
    if test "$HAVE_SQLITE3" = "yes"; then
      SQLITE3_LIBS=-lsqlite3
-     AC_SUBST(SQLITE3_LIBS)
-     LIBS="$SQLITE3_LIBS $LIBS"
+     SQLITE3_OBJ=sqlite.o
      AC_DEFINE(HAVE_SQLITE3, 1, [Define to 1 if you have the libsqlite3 library (-lsqlite).])
-     # Windows loads libsqlite dynamically
-     if test "${opsys}" = "mingw32"; then
-        SQLITE3_LIBS=
-     fi
      AC_CHECK_LIB(sqlite3, sqlite3_load_extension,
          HAVE_SQLITE3_LOAD_EXTENSION=yes, HAVE_SQLITE3_LOAD_EXTENSION=no)
      if test "$HAVE_SQLITE3_LOAD_EXTENSION" = "yes"; then
        AC_DEFINE(HAVE_SQLITE3_LOAD_EXTENSION, 1, [Define to 1 if sqlite3 supports loading extensions.])
      fi
+     # Windows loads libsqlite dynamically
+     if test "${opsys}" = "mingw32"; then
+       SQLITE3_LIBS=
+     fi
    fi
 fi
 
+AC_SUBST(HAVE_SQLITE3)
+AC_SUBST(SQLITE3_LIBS)
+AC_SUBST(SQLITE3_CFLAGS)
+AC_SUBST(SQLITE3_OBJ)
+
 HAVE_IMAGEMAGICK=no
 if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${HAVE_W32}" = "yes" || \
    test "${HAVE_BE_APP}" = "yes"; then
diff --git a/lisp/sqlite-mode.el b/lisp/sqlite-mode.el
index 9306bd85dcd..823dfeb07d6 100644
--- a/lisp/sqlite-mode.el
+++ b/lisp/sqlite-mode.el
@@ -25,6 +25,14 @@
 
 (require 'cl-lib)
 
+(declare-function sqlite-execute "sqlite.c")
+(declare-function sqlite-more-p "sqlite.c")
+(declare-function sqlite-next "sqlite.c")
+(declare-function sqlite-columns "sqlite.c")
+(declare-function sqlite-finalize "sqlite.c")
+(declare-function sqlite-select "sqlite.c")
+(declare-function sqlite-open "sqlite.c")
+
 (defvar-keymap sqlite-mode-map
   "g" #'sqlite-mode-list-tables
   "c" #'sqlite-mode-list-columns
diff --git a/src/Makefile.in b/src/Makefile.in
index 3a8445db2d4..85c10103c4e 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -238,6 +238,8 @@ IMAGEMAGICK_CFLAGS=
 LIBXML2_LIBS = @LIBXML2_LIBS@
 LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
 
+SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
+SQLITE3_OBJ = @SQLITE3_OBJ@
 SQLITE3_LIBS = @SQLITE3_LIBS@
 
 GETADDRINFO_A_LIBS = @GETADDRINFO_A_LIBS@
@@ -330,6 +332,10 @@ JSON_LIBS =
 JSON_CFLAGS = @JSON_CFLAGS@
 JSON_OBJ = @JSON_OBJ@
 
+SQLITE3_LIBS = @SQLITE3_LIBS@
+SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
+SQLITE3_OBJ = @SQLITE3_OBJ@
+
 INTERVALS_H = dispextern.h intervals.h composite.h
 
 GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
@@ -395,7 +401,7 @@ EMACS_CFLAGS=
   $(HARFBUZZ_CFLAGS) $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \
   $(LIBSYSTEMD_CFLAGS) $(JSON_CFLAGS) \
   $(LIBGNUTLS_CFLAGS) $(NOTIFY_CFLAGS) $(CAIRO_CFLAGS) \
-  $(WERROR_CFLAGS) $(HAIKU_CFLAGS)
+  $(WERROR_CFLAGS) $(HAIKU_CFLAGS) $(SQLITE3_CFLAGS)
 ALL_CFLAGS = $(EMACS_CFLAGS) $(WARN_CFLAGS) $(CFLAGS)
 ALL_OBJC_CFLAGS = $(EMACS_CFLAGS) \
   $(filter-out $(NON_OBJC_CFLAGS),$(WARN_CFLAGS)) $(CFLAGS) \
@@ -428,11 +434,11 @@ base_obj =
 	doprnt.o intervals.o textprop.o composite.o xml.o lcms.o $(NOTIFY_OBJ) \
 	$(XWIDGETS_OBJ) \
 	profiler.o decompress.o \
-	thread.o systhread.o sqlite.o \
+	thread.o systhread.o \
 	$(if $(HYBRID_MALLOC),sheap.o) \
 	$(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \
 	$(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ) $(JSON_OBJ) \
-	$(HAIKU_OBJ)
+	$(HAIKU_OBJ) $(SQLITE3_OBJ)
 doc_obj = $(base_obj) $(NS_OBJC_OBJ)
 obj = $(doc_obj) $(HAIKU_CXX_OBJ)
 
diff --git a/src/alloc.c b/src/alloc.c
index 9f52a414d68..a9ba9885fd8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -50,6 +50,10 @@ Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2021 Free Software
 #include TERM_HEADER
 #endif /* HAVE_WINDOW_SYSTEM */
 
+#ifdef HAVE_SQLITE3
+#include "sqlite.h"
+#endif
+
 #include <flexmember.h>
 #include <verify.h>
 #include <execinfo.h>           /* For backtrace.  */
@@ -125,7 +129,6 @@ Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2021 Free Software
   struct Lisp_Overlay Lisp_Overlay;
   struct Lisp_Sub_Char_Table Lisp_Sub_Char_Table;
   struct Lisp_Subr Lisp_Subr;
-  struct Lisp_Sqlite Lisp_Sqlite;
   struct Lisp_User_Ptr Lisp_User_Ptr;
   struct Lisp_Vector Lisp_Vector;
   struct terminal terminal;
@@ -3181,6 +3184,12 @@ cleanup_vector (struct Lisp_Vector *vector)
 	}
     }
 #endif
+#ifdef HAVE_SQLITE3
+  else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_SQLITE))
+    {
+      /* clean s___ up.  To be implemented.  */
+    }
+#endif
 }
 
 /* Reclaim space used by unmarked vectors.  */
diff --git a/src/data.c b/src/data.c
index f07667b0003..81ae2f412ad 100644
--- a/src/data.c
+++ b/src/data.c
@@ -4069,6 +4069,7 @@ #define PUT_ERROR(sym, tail, msg)			\
   DEFSYM (Qterminal, "terminal");
   DEFSYM (Qxwidget, "xwidget");
   DEFSYM (Qxwidget_view, "xwidget-view");
+  DEFSYM (Qsqlite, "sqlite");
 
   DEFSYM (Qdefun, "defun");
 
diff --git a/src/emacs.c b/src/emacs.c
index 3fc055aed92..05441b06825 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -81,6 +81,10 @@ #define MAIN_PROGRAM
 #include TERM_HEADER
 #endif /* HAVE_WINDOW_SYSTEM */
 
+#ifdef HAVE_SQLITE3
+#include "sqlite.h"
+#endif /* HAVE_SQLITE3 */
+
 #include "bignum.h"
 #include "intervals.h"
 #include "character.h"
@@ -2183,8 +2187,10 @@ main (int argc, char **argv)
 #endif
       syms_of_window ();
       syms_of_xdisp ();
-      syms_of_sqlite ();
       syms_of_font ();
+#ifdef HAVE_SQLITE3
+      syms_of_sqlite ();
+#endif
 #ifdef HAVE_WINDOW_SYSTEM
       syms_of_fringe ();
       syms_of_image ();
diff --git a/src/lisp.h b/src/lisp.h
index 92ab05b4228..aa48b218d36 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2571,17 +2571,6 @@ xmint_pointer (Lisp_Object a)
   return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Misc_Ptr)->pointer;
 }
 
-struct Lisp_Sqlite
-{
-  union vectorlike_header header;
-  void *db;
-  void *stmt;
-  char *name;
-  void (*finalizer) (void *);
-  bool eof;
-  bool is_statement;
-} GCALIGNED_STRUCT;
-
 struct Lisp_User_Ptr
 {
   union vectorlike_header header;
@@ -2659,31 +2648,6 @@ XUSER_PTR (Lisp_Object a)
   return XUNTAG (a, Lisp_Vectorlike, struct Lisp_User_Ptr);
 }
 
-INLINE bool
-SQLITEP (Lisp_Object x)
-{
-  return PSEUDOVECTORP (x, PVEC_SQLITE);
-}
-
-INLINE bool
-SQLITE (Lisp_Object a)
-{
-  return PSEUDOVECTORP (a, PVEC_SQLITE);
-}
-
-INLINE void
-CHECK_SQLITE (Lisp_Object x)
-{
-  CHECK_TYPE (SQLITE (x), Qsqlitep, x);
-}
-
-INLINE struct Lisp_Sqlite *
-XSQLITE (Lisp_Object a)
-{
-  eassert (SQLITEP (a));
-  return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Sqlite);
-}
-
 INLINE bool
 BIGNUMP (Lisp_Object x)
 {
diff --git a/src/print.c b/src/print.c
index 214f1d12c11..f06ceb308a6 100644
--- a/src/print.c
+++ b/src/print.c
@@ -40,6 +40,10 @@ Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2021 Free Software
 #include <ftoastr.h>
 #include <math.h>
 
+#ifdef HAVE_SQLITE3
+#include <sqlite.h>
+#endif
+
 #if IEEE_FLOATING_POINT
 # include <ieee754.h>
 #endif
@@ -1875,6 +1879,7 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag,
       }
       break;
 #endif
+#ifdef HAVE_SQLITE3
     case PVEC_SQLITE:
       {
 	print_c_string ("#<sqlite ", printcharfun);
@@ -1890,7 +1895,7 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag,
 	printchar ('>', printcharfun);
       }
       break;
-
+#endif
     default:
       emacs_abort ();
     }
diff --git a/src/sqlite.c b/src/sqlite.c
index d92dcf723c9..f9b57c8d387 100644
--- a/src/sqlite.c
+++ b/src/sqlite.c
@@ -25,8 +25,7 @@ Copyright (C) 2021 Free Software Foundation, Inc.
 #include <config.h>
 #include "lisp.h"
 #include "coding.h"
-
-#ifdef HAVE_SQLITE3
+#include "sqlite.h"
 
 #include <sqlite3.h>
 
@@ -644,24 +643,17 @@ DEFUN ("sqlite-finalize", Fsqlite_finalize, Ssqlite_finalize, 1, 1, 0,
   return Qt;
 }
 
-#endif /* HAVE_SQLITE3 */
-
 DEFUN ("sqlitep", Fsqlitep, Ssqlitep, 1, 1, 0,
        doc: /* Say whether OBJECT is an SQlite object.  */)
   (Lisp_Object object)
 {
-#ifdef HAVE_SQLITE3
-  return SQLITE (object)? Qt: Qnil;
-#else
-  return Qnil;
-#endif
+  return SQLITEP (object) ? Qt: Qnil;
 }
 
 DEFUN ("sqlite-available-p", Fsqlite_available_p, Ssqlite_available_p, 0, 0, 0,
        doc: /* Return t if sqlite3 support is available in this instance of Emacs.*/)
   (void)
 {
-#ifdef HAVE_SQLITE3
 # ifdef WINDOWSNT
   Lisp_Object found = Fassq (Qsqlite3, Vlibrary_cache);
   if (CONSP (found))
@@ -671,15 +663,11 @@ DEFUN ("sqlite-available-p", Fsqlite_available_p, Ssqlite_available_p, 0, 0, 0,
 # else
   return Qt;
 #endif
-#else
-  return Qnil;
-#endif
 }
 
 void
 syms_of_sqlite (void)
 {
-#ifdef HAVE_SQLITE3
   defsubr (&Ssqlite_open);
   defsubr (&Ssqlite_close);
   defsubr (&Ssqlite_execute);
@@ -696,7 +684,7 @@ syms_of_sqlite (void)
   defsubr (&Ssqlite_finalize);
   DEFSYM (Qset, "set");
   DEFSYM (Qfull, "full");
-#endif
+
   defsubr (&Ssqlitep);
   DEFSYM (Qsqlitep, "sqlitep");
   defsubr (&Ssqlite_available_p);
diff --git a/src/sqlite.h b/src/sqlite.h
new file mode 100644
index 00000000000..0d26f0b7b8f
--- /dev/null
+++ b/src/sqlite.h
@@ -0,0 +1,59 @@
+/* Header file for the sqlite3 integration.
+
+Copyright (C) 2021 Free Software Foundation, Inc.
+
+This file is NOT part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef EMACS_SQLITE_H
+#define EMACS_SQLITE_H
+
+#include "lisp.h"
+
+INLINE_HEADER_BEGIN
+
+struct Lisp_Sqlite
+{
+  union vectorlike_header header;
+  void *db;
+  void *stmt;
+  char *name;
+  void (*finalizer) (void *);
+  bool eof;
+  bool is_statement;
+};
+
+INLINE bool
+SQLITEP (Lisp_Object x)
+{
+  return PSEUDOVECTORP (x, PVEC_SQLITE);
+}
+
+INLINE struct Lisp_Sqlite *
+XSQLITE (Lisp_Object a)
+{
+  eassert (SQLITEP (a));
+  return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Sqlite);
+}
+
+INLINE void
+CHECK_SQLITE (Lisp_Object sql)
+{
+  CHECK_TYPE (SQLITEP (sql), Qsqlitep, sql);
+}
+
+INLINE_HEADER_END
+
+#endif /* EMACS_SQLITE_H */
diff --git a/test/Makefile.in b/test/Makefile.in
index f2c49584e7f..f3f7855b439 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -48,7 +48,6 @@ SO =
 SEPCHAR = @SEPCHAR@
 
 HAVE_NATIVE_COMP = @HAVE_NATIVE_COMP@
-
 REPLACE_FREE = @REPLACE_FREE@
 
 -include ${top_builddir}/src/verbose.mk
diff --git a/test/src/sqlite-tests.el b/test/src/sqlite-tests.el
index 7ccea1c2a54..58949b2ebc6 100644
--- a/test/src/sqlite-tests.el
+++ b/test/src/sqlite-tests.el
@@ -25,6 +25,17 @@
 
 (require 'ert)
 (require 'ert-x)
+(require 'sqlite-mode)
+
+(declare-function sqlite-execute "sqlite.c")
+(declare-function sqlite-close "sqlite.c")
+(declare-function sqlitep "sqlite.c")
+(declare-function sqlite-available-p "sqlite.c")
+(declare-function sqlite-finalize "sqlite.c")
+(declare-function sqlite-next "sqlite.c")
+(declare-function sqlite-more-p "sqlite.c")
+(declare-function sqlite-select "sqlite.c")
+(declare-function sqlite-open "sqlite.c")
 
 (ert-deftest sqlite-select ()
   (skip-unless (sqlite-available-p))
-- 
2.26.2


[-- Attachment #3: Type: text/plain, Size: 6844 bytes --]




In Commercial Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.10)
 of 2021-12-11 built on dick
Repository revision: 783c1910c3bdc9fc47fee3b305fa3e4c17d42b7b
Repository branch: longlines
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Ubuntu 18.04.4 LTS

Configured using:
 'configure --prefix=/home/dick/.local --enable-checking
 --with-tree-sitter --enable-dumping-overwrite CC=gcc-10 'CFLAGS=-g3 -Og
 -I/home/dick/.local/include/' LDFLAGS=-L/home/dick/.local/lib
 PKG_CONFIG_PATH=/home/dick/.local/lib/pkgconfig CXX=gcc-10'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
TREE-SITTER LCMS2 LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM
XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Magit

Minor modes in effect:
  async-bytecomp-package-mode: t
  global-git-commit-mode: t
  shell-dirtrack-mode: t
  projectile-mode: t
  flx-ido-mode: t
  override-global-mode: t
  global-hl-line-mode: t
  winner-mode: t
  tooltip-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/dick/gomacro-mode/gomacro-mode hides /home/dick/.emacs.d/elpa/gomacro-mode-20200326.1103/gomacro-mode
/home/dick/.emacs.d/elpa/hydra-20170924.2259/lv hides /home/dick/.emacs.d/elpa/lv-20191106.1238/lv
/home/dick/.emacs.d/elpa/magit-3.3.0/magit-section-pkg hides /home/dick/.emacs.d/elpa/magit-section-3.3.0/magit-section-pkg
/home/dick/org-gcal.el/org-gcal hides /home/dick/.emacs.d/elpa/org-gcal-0.3/org-gcal
/home/dick/.emacs.d/lisp/json hides /home/dick/emacs/lisp/json
/home/dick/.emacs.d/elpa/transient-0.3.6/transient hides /home/dick/emacs/lisp/transient
/home/dick/.emacs.d/elpa/hierarchy-20171221.1151/hierarchy hides /home/dick/emacs/lisp/emacs-lisp/hierarchy

Features:
(shadow sort footnote mail-extr gnus-msg gnus-art mm-uu mml2015 mm-view
mml-smime smime dig gnus-sum shr pixel-fill kinsoku svg dom gnus-group
mm-url gnus-undo gnus-start gnus-dbus gnus-cloud nnimap nnmail
mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range gnus-win
emacsbug sendmail benchmark pulse help-fns radix-tree find-func vc-mtn
vc-hg vc-bzr vc-src vc-sccs vc-cvs vc-rcs tramp-archive tramp-gvfs
tramp-cache zeroconf dbus xml tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat parse-time iso8601 ls-lisp vc
bug-reference cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs magit-extras sh-script executable
rect face-remap magit-patch-changelog magit-patch magit-submodule
magit-obsolete magit-popup async-bytecomp async magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
which-func imenu magit-diff smerge-mode diff git-commit log-edit message
yank-media rmc puny rfc822 mml mml-sec epa epg rfc6068 epg-config
mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader pcvs-util
add-log magit-core magit-margin magit-transient magit-process
with-editor shell pcomplete server magit-mode transient format-spec
make-mode ag vc-svn find-dired s dired-x dired dired-loaddefs misearch
multi-isearch vc-git diff-mode vc-dispatcher autoconf autoconf-mode
paredit-ext paredit subed subed-vtt subed-srt subed-common subed-mpv
subed-debug subed-config inf-ruby ruby-mode smie company pcase
haskell-interactive-mode haskell-presentation-mode haskell-process
haskell-session haskell-compile haskell-mode haskell-cabal haskell-utils
haskell-font-lock haskell-indentation haskell-string
haskell-sort-imports haskell-lexeme haskell-align-imports
haskell-complete-module haskell-ghc-support noutline outline
flymake-proc flymake warnings etags fileloop generator xref project
dabbrev haskell-customize hydra lv use-package-ensure solarized-theme
solarized-definitions projectile lisp-mnt mail-parse rfc2231 ibuf-ext
ibuffer ibuffer-loaddefs thingatpt magit-autorevert autorevert
filenotify magit-git magit-section magit-utils crm dash rx grep compile
comint ansi-color gnus nnheader gnus-util rmail rmail-loaddefs rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils text-property-search
time-date flx-ido flx google-translate-default-ui
google-translate-core-ui facemenu color ido google-translate-core
google-translate-tk google-translate-backend use-package-bind-key
bind-key auto-complete easy-mmode advice edmacro kmacro popup cus-edit
pp cus-load wid-edit emms-player-mplayer emms-player-simple emms
emms-compat cl-extra help-mode use-package-core derived hl-line winner
ring finder-inf json-reformat-autoloads json-snatcher-autoloads
sml-mode-autoloads tornado-template-mode-autoloads info package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json map url-vars seq gv subr-x byte-opt bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tree-sitter tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget keymap hashtable-print-readable backquote threads
dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 974965 153625)
 (symbols 48 35753 1)
 (strings 32 136426 20527)
 (string-bytes 1 4530479)
 (vectors 16 98269)
 (vector-slots 8 2745491 89364)
 (floats 8 464 1477)
 (intervals 56 71313 6420)
 (buffers 992 32))

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3)
  2021-12-11 21:32 bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3) dick.r.chiang
@ 2021-12-12  6:12 ` Lars Ingebrigtsen
  2021-12-12  7:52   ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-12  6:12 UTC (permalink / raw)
  To: dick.r.chiang; +Cc: 52440

dick.r.chiang@gmail.com writes:

> -OPTION_DEFAULT_ON([sqlite3],[don't compile with sqlite3 support])
> +OPTION_DEFAULT_OFF([sqlite3],[don't compile with sqlite3 support])

No, we're defaulting it to on.

> -     AC_SUBST(SQLITE3_LIBS)
> -     LIBS="$SQLITE3_LIBS $LIBS"
> +     SQLITE3_OBJ=sqlite.o

No, we're always building the sqlite.o file.  We've tried out different
variants of this over the years, but always compiling the files (and
if-deffing out almost everything in it) is the least work in the long
run.

> diff --git a/lisp/sqlite-mode.el b/lisp/sqlite-mode.el
> index 9306bd85dcd..823dfeb07d6 100644
> --- a/lisp/sqlite-mode.el
> +++ b/lisp/sqlite-mode.el
> @@ -25,6 +25,14 @@
>  
>  (require 'cl-lib)
>  
> +(declare-function sqlite-execute "sqlite.c")
> +(declare-function sqlite-more-p "sqlite.c")
> +(declare-function sqlite-next "sqlite.c")
> +(declare-function sqlite-columns "sqlite.c")
> +(declare-function sqlite-finalize "sqlite.c")
> +(declare-function sqlite-select "sqlite.c")
> +(declare-function sqlite-open "sqlite.c")

Thanks; applied.

> --- a/src/lisp.h
> +++ b/src/lisp.h
> @@ -2571,17 +2571,6 @@ xmint_pointer (Lisp_Object a)
>    return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Misc_Ptr)->pointer;
>  }
>  
> -struct Lisp_Sqlite
> -{
> -  union vectorlike_header header;
> -  void *db;
> -  void *stmt;
> -  char *name;
> -  void (*finalizer) (void *);
> -  bool eof;
> -  bool is_statement;
> -} GCALIGNED_STRUCT;

I thought including this in lisp.h instead of adding a separate .h and
#ifdeffing all over the place was the most readable, but I have no
strong opinion on that.  Eli, what do you think?

> --- a/test/src/sqlite-tests.el
> +++ b/test/src/sqlite-tests.el
> @@ -25,6 +25,17 @@
>  
>  (require 'ert)
>  (require 'ert-x)
> +(require 'sqlite-mode)

I don't think this file is testing anything in sqlite-mode?

> +(declare-function sqlite-execute "sqlite.c")
> +(declare-function sqlite-close "sqlite.c")
> +(declare-function sqlitep "sqlite.c")
> +(declare-function sqlite-available-p "sqlite.c")
> +(declare-function sqlite-finalize "sqlite.c")
> +(declare-function sqlite-next "sqlite.c")
> +(declare-function sqlite-more-p "sqlite.c")
> +(declare-function sqlite-select "sqlite.c")
> +(declare-function sqlite-open "sqlite.c")

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3)
  2021-12-12  6:12 ` Lars Ingebrigtsen
@ 2021-12-12  7:52   ` Eli Zaretskii
  2021-12-12 11:32     ` dick
  2021-12-12 11:49     ` Lars Ingebrigtsen
  0 siblings, 2 replies; 13+ messages in thread
From: Eli Zaretskii @ 2021-12-12  7:52 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 52440, dick.r.chiang

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: 52440@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
> Date: Sun, 12 Dec 2021 07:12:16 +0100
> 
> > --- a/src/lisp.h
> > +++ b/src/lisp.h
> > @@ -2571,17 +2571,6 @@ xmint_pointer (Lisp_Object a)
> >    return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Misc_Ptr)->pointer;
> >  }
> >  
> > -struct Lisp_Sqlite
> > -{
> > -  union vectorlike_header header;
> > -  void *db;
> > -  void *stmt;
> > -  char *name;
> > -  void (*finalizer) (void *);
> > -  bool eof;
> > -  bool is_statement;
> > -} GCALIGNED_STRUCT;
> 
> I thought including this in lisp.h instead of adding a separate .h and
> #ifdeffing all over the place was the most readable, but I have no
> strong opinion on that.  Eli, what do you think?

I don't like including other headers in lisp.h if those headers define
stuff important for the Lisp interpreter.  We did that with thread.h,
and I have a lot of bad memories from that experiment.  The main
problem is recursive dependencies between lisp.h and the included
header (which bite you if you move the place of the inclusion).  The
need to recompile everything when the included header changes (because
lisp.h is included by every source file) is also a nuisance.

However, the proof of the pudding is in eating: we do something like
the above with comp.h, for example (but also have HAVE_NATIVE_COMP
conditionals in lisp.h all over the place), so eventually it depends
on how many hoops we have to jump through to make the separation
happen.  If it's feasible to keep sqlite.h to a bare minimum, like
comp.h did, but without leaving a lot of sqlite stuff in lisp.h,
perhaps it's worthwhile?

OTOH, sqlite has (or should have) a relatively small impact on lisp.h,
as it basically defines a single data type.  The amount of sqlite
stuff in lisp.h is quite small, for that reason.  So I tend to think a
separate header is overkill.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3)
  2021-12-12  7:52   ` Eli Zaretskii
@ 2021-12-12 11:32     ` dick
  2021-12-12 12:01       ` Eli Zaretskii
  2021-12-12 11:49     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 13+ messages in thread
From: dick @ 2021-12-12 11:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 52440, Lars Ingebrigtsen

EZ> The amount of sqlite stuff in lisp.h is quite small...  So I tend
EZ> to think a separate header is overkill.

Thinking about this in terms of number of bytes added to lisp.h is the
wrong way to think about it.

I agree that Lisp_Process, while important, doesn't belong in lisp.h.
That something as ancillary, third-party, and controversial as
Lisp_Sqlite does get into lisp.h is a testimony about its author.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3)
  2021-12-12  7:52   ` Eli Zaretskii
  2021-12-12 11:32     ` dick
@ 2021-12-12 11:49     ` Lars Ingebrigtsen
  2021-12-12 12:04       ` Eli Zaretskii
  1 sibling, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-12 11:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 52440, dick.r.chiang

Eli Zaretskii <eliz@gnu.org> writes:

> OTOH, sqlite has (or should have) a relatively small impact on lisp.h,
> as it basically defines a single data type.  The amount of sqlite
> stuff in lisp.h is quite small, for that reason.  So I tend to think a
> separate header is overkill.

Yeah, me too.  Separating it out doesn't seem like a clear win here, so
I'm closing this bug report.

(But if you do decide to rearrange this (and put it in a separate .h
file), I won't protest -- I didn't really give the organisation much
thought at all.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3)
  2021-12-12 11:32     ` dick
@ 2021-12-12 12:01       ` Eli Zaretskii
  2021-12-12 12:46         ` dick
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2021-12-12 12:01 UTC (permalink / raw)
  To: dick; +Cc: 52440, larsi

> From: dick <dick.r.chiang@gmail.com>
> Cc: Lars Ingebrigtsen <larsi@gnus.org>,  52440@debbugs.gnu.org
> Date: Sun, 12 Dec 2021 06:32:27 -0500
> 
> EZ> The amount of sqlite stuff in lisp.h is quite small...  So I tend
> EZ> to think a separate header is overkill.
> 
> Thinking about this in terms of number of bytes added to lisp.h is the
> wrong way to think about it.

If that's the only aspect, perhaps.  But it isn't the only aspect:
there are others, which I mentioned, and you elided.  Together with
them, the size is relevant to decide between the alternatives.

> I agree that Lisp_Process, while important, doesn't belong in lisp.h.
> That something as ancillary, third-party, and controversial as
> Lisp_Sqlite does get into lisp.h is a testimony about its author.

We are not dogmatic about this stuff.  This is C, not C++, so what
goes into what header is not subject to dogma.  And this isn't the
case that just files dealing with sqlite will include this header:
every source file that deals with Lisp objects will need it, so at
least conceptually it belongs to lisp.h.  Triggering unnecessary
rebuilds is an annoyance during development, so it's no less important
than purity of the headers.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3)
  2021-12-12 11:49     ` Lars Ingebrigtsen
@ 2021-12-12 12:04       ` Eli Zaretskii
  0 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2021-12-12 12:04 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 52440, dick.r.chiang

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: dick.r.chiang@gmail.com,  52440@debbugs.gnu.org
> Date: Sun, 12 Dec 2021 12:49:42 +0100
> 
> (But if you do decide to rearrange this (and put it in a separate .h
> file), I won't protest -- I didn't really give the organisation much
> thought at all.)

Time will tell.  For now it's just one struct and a small number of
inline functions, not very different from, say, Lisp_Float.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3)
  2021-12-12 12:01       ` Eli Zaretskii
@ 2021-12-12 12:46         ` dick
  2021-12-12 13:28           ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: dick @ 2021-12-12 12:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 52440, larsi

> Triggering unnecessary rebuilds is an annoyance during development

I don't see how keeping the three functions in lisp.h versus sqlite.h
makes triggering the world any less frequent.

And besides, I find myself *constantly* having to `git clean -dfX` and
remake the world on account of:

Error: Recursive load: "...international/uni-special-lowercase.el"

Your marshalling of the recompilation nuisance is formulaic
straw-grasping to get one's way.  I know because I often use the same
rhetorical device.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3)
  2021-12-12 12:46         ` dick
@ 2021-12-12 13:28           ` Eli Zaretskii
  2021-12-12 14:25             ` dick
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2021-12-12 13:28 UTC (permalink / raw)
  To: dick; +Cc: 52440, larsi

> From: dick <dick.r.chiang@gmail.com>
> Cc: larsi@gnus.org,  52440@debbugs.gnu.org
> Date: Sun, 12 Dec 2021 07:46:28 -0500
> 
> > Triggering unnecessary rebuilds is an annoyance during development
> 
> I don't see how keeping the three functions in lisp.h versus sqlite.h
> makes triggering the world any less frequent.

It's the other way around: separating them will NOT make rebuilds less
frequent.  So it's kinda fruitless, as separations go.

> And besides, I find myself *constantly* having to `git clean -dfX` and
> remake the world on account of:
> 
> Error: Recursive load: "...international/uni-special-lowercase.el"

Doesn't happen here, never did.

> Your marshalling of the recompilation nuisance is formulaic
> straw-grasping to get one's way.  I know because I often use the same
> rhetorical device.

You are evidently talking about yourself, so don't expect me to assign
any significance to that.  Doesn't help your prestige around here,
which is already pretty low.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3)
  2021-12-12 13:28           ` Eli Zaretskii
@ 2021-12-12 14:25             ` dick
  2021-12-12 14:38               ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: dick @ 2021-12-12 14:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 52440, larsi

> It's the other way around: separating them will NOT make rebuilds less
> frequent.  So it's kinda fruitless, as separations go.

Interesting.  I just edited sqlite.h in my fork, and it didn't recompile
the world.  So thanks for suggesting another reason why disaggregating
the sqlite junk from lisp.h is superior.  Why thread.h is included in
lisp.h is a decision that predates me.

> Doesn't help your prestige around here, which is already pretty low.

Prestige?  The path we've chosen -- slavishly obsessing over a last-century
text editor fast becoming extinct -- is quite possibly the least
prestigious endeavor I can think of.  Affability is probably the word
you're looking for.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3)
  2021-12-12 14:25             ` dick
@ 2021-12-12 14:38               ` Eli Zaretskii
  2021-12-12 15:04                 ` dick
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2021-12-12 14:38 UTC (permalink / raw)
  To: dick; +Cc: 52440, larsi

> From: dick <dick.r.chiang@gmail.com>
> Cc: larsi@gnus.org,  52440@debbugs.gnu.org
> Date: Sun, 12 Dec 2021 09:25:13 -0500
> 
> > It's the other way around: separating them will NOT make rebuilds less
> > frequent.  So it's kinda fruitless, as separations go.
> 
> Interesting.  I just edited sqlite.h in my fork, and it didn't recompile
> the world.

I guess sqlite.h in your fork includes only some of the sqlite stuff,
then.  Which then begs the question why have it in more than one
place?  Or maybe your sqlite.h includes lisp.h, which is also not a
very good idea.

You cannot usefully separate into different files parts of the Lisp
interpreter, they are too intertwined.  Might as well stop trying.

Anyway, this seems to be about personal stylistic preferences, so any
further argument is futile.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3)
  2021-12-12 14:38               ` Eli Zaretskii
@ 2021-12-12 15:04                 ` dick
  2021-12-13  1:55                   ` Phil Sainty
  0 siblings, 1 reply; 13+ messages in thread
From: dick @ 2021-12-12 15:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 52440

> You cannot usefully separate into different files parts of the Lisp
> interpreter, they are too intertwined.  Might as well stop trying.

Pretty egregious straw-grasping here.

> Anyway, this seems to be about personal stylistic preferences, so any
> further argument is futile.

No, it's C programming 101.  You'll get the hang of it.  I was an even
worse programmer than you when I graduated university.  By the time you
get to my age and experience, you'll be the Vader to my Kenobi.

Not that I fancy myself a jedi in programming, far from it.  But you get
the idea.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3)
  2021-12-12 15:04                 ` dick
@ 2021-12-13  1:55                   ` Phil Sainty
  0 siblings, 0 replies; 13+ messages in thread
From: Phil Sainty @ 2021-12-13  1:55 UTC (permalink / raw)
  To: dick; +Cc: 52440

On 2021-12-13 04:04, dick wrote:
> No, it's C programming 101.  You'll get the hang of it.  I was an even
> worse programmer than you when I graduated university.  By the time you
> get to my age and experience, you'll be the Vader to my Kenobi.

In my personal opinion...

This is not (ever) the way to collaborate on a project.  In the years
I've been subscribed to these lists I can't recall anyone remotely as
obnoxious as you choose to be on a regular basis.

My *impression* is that you could be a valuable contributor (and you
even seem to be working on some things which I personally would like
to see in Emacs); but if this was my project you would not be welcome
with the attitude that I've seen from you thus far, regardless of your
skills as a programmer.


-Phil






^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-12-13  1:55 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-11 21:32 bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3) dick.r.chiang
2021-12-12  6:12 ` Lars Ingebrigtsen
2021-12-12  7:52   ` Eli Zaretskii
2021-12-12 11:32     ` dick
2021-12-12 12:01       ` Eli Zaretskii
2021-12-12 12:46         ` dick
2021-12-12 13:28           ` Eli Zaretskii
2021-12-12 14:25             ` dick
2021-12-12 14:38               ` Eli Zaretskii
2021-12-12 15:04                 ` dick
2021-12-13  1:55                   ` Phil Sainty
2021-12-12 11:49     ` Lars Ingebrigtsen
2021-12-12 12:04       ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).