Commit e7989413a8a5d6e8b2471eefc8372a12e44114a5

Authored by Jay Berkenbilt
Committed by m-holger
1 parent 20126227

Disable PointerHolder by default

CMakeLists.txt
@@ -120,7 +120,6 @@ if(NOT (BUILD_STATIC_LIBS OR BUILD_SHARED_LIBS)) @@ -120,7 +120,6 @@ if(NOT (BUILD_STATIC_LIBS OR BUILD_SHARED_LIBS))
120 endif() 120 endif()
121 121
122 set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON) 122 set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
123 -add_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:POINTERHOLDER_TRANSITION=4>)  
124 123
125 if(ENABLE_QTC) 124 if(ENABLE_QTC)
126 set(ENABLE_QTC_ARG) 125 set(ENABLE_QTC_ARG)
ChangeLog
1 2025-02-15 Jay Berkenbilt <ejb@ql.org> 1 2025-02-15 Jay Berkenbilt <ejb@ql.org>
2 2
  3 + * Disable PointerHolder by default.
  4 +
  5 +2025-02-15 Jay Berkenbilt <ejb@ql.org>
  6 +
3 * 11.10.1: release 7 * 11.10.1: release
4 8
5 * Detect cygwin as Windows for fix-qdf tests that don't work on 9 * Detect cygwin as Windows for fix-qdf tests that don't work on
include/qpdf/Buffer.hh
@@ -21,7 +21,6 @@ @@ -21,7 +21,6 @@
21 #define BUFFER_HH 21 #define BUFFER_HH
22 22
23 #include <qpdf/DLL.h> 23 #include <qpdf/DLL.h>
24 -#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)  
25 24
26 #include <cstddef> 25 #include <cstddef>
27 #include <memory> 26 #include <memory>
include/qpdf/ClosedFileInputSource.hh
@@ -26,7 +26,6 @@ @@ -26,7 +26,6 @@
26 // merging large numbers of files. 26 // merging large numbers of files.
27 27
28 #include <qpdf/InputSource.hh> 28 #include <qpdf/InputSource.hh>
29 -#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)  
30 29
31 #include <memory> 30 #include <memory>
32 31
include/qpdf/InputSource.hh
@@ -21,7 +21,6 @@ @@ -21,7 +21,6 @@
21 #define QPDF_INPUTSOURCE_HH 21 #define QPDF_INPUTSOURCE_HH
22 22
23 #include <qpdf/DLL.h> 23 #include <qpdf/DLL.h>
24 -#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)  
25 #include <qpdf/Types.h> 24 #include <qpdf/Types.h>
26 25
27 #include <cstdio> 26 #include <cstdio>
include/qpdf/JSON.hh
@@ -30,7 +30,6 @@ @@ -30,7 +30,6 @@
30 // is also a good reason not to use this as a general-purpose JSON package. 30 // is also a good reason not to use this as a general-purpose JSON package.
31 31
32 #include <qpdf/DLL.h> 32 #include <qpdf/DLL.h>
33 -#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)  
34 #include <qpdf/Types.h> 33 #include <qpdf/Types.h>
35 34
36 #include <functional> 35 #include <functional>
include/qpdf/Pipeline.hh
@@ -37,7 +37,6 @@ @@ -37,7 +37,6 @@
37 #define PIPELINE_HH 37 #define PIPELINE_HH
38 38
39 #include <qpdf/DLL.h> 39 #include <qpdf/DLL.h>
40 -#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)  
41 40
42 #include <memory> 41 #include <memory>
43 #include <string> 42 #include <string>
include/qpdf/Pl_Buffer.hh
@@ -31,7 +31,6 @@ @@ -31,7 +31,6 @@
31 31
32 #include <qpdf/Buffer.hh> 32 #include <qpdf/Buffer.hh>
33 #include <qpdf/Pipeline.hh> 33 #include <qpdf/Pipeline.hh>
34 -#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)  
35 34
36 #include <memory> 35 #include <memory>
37 #include <string> 36 #include <string>
include/qpdf/Pl_QPDFTokenizer.hh
@@ -23,7 +23,6 @@ @@ -23,7 +23,6 @@
23 #include <qpdf/Pipeline.hh> 23 #include <qpdf/Pipeline.hh>
24 24
25 #include <qpdf/Pl_Buffer.hh> 25 #include <qpdf/Pl_Buffer.hh>
26 -#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)  
27 #include <qpdf/QPDFObjectHandle.hh> 26 #include <qpdf/QPDFObjectHandle.hh>
28 #include <qpdf/QPDFTokenizer.hh> 27 #include <qpdf/QPDFTokenizer.hh>
29 28
include/qpdf/PointerHolder.hh
@@ -26,18 +26,12 @@ @@ -26,18 +26,12 @@
26 #define POINTERHOLDER_IS_SHARED_POINTER 26 #define POINTERHOLDER_IS_SHARED_POINTER
27 27
28 #ifndef POINTERHOLDER_TRANSITION 28 #ifndef POINTERHOLDER_TRANSITION
29 -  
30 -// #define POINTERHOLDER_TRANSITION 0 to suppress this warning, and see below.  
31 -// See also https://qpdf.readthedocs.io/en/stable/design.html#smart-pointers  
32 -# warning "POINTERHOLDER_TRANSITION is not defined -- see qpdf/PointerHolder.hh"  
33 -  
34 -// undefined = define as 0 and issue a warning  
35 // 0 = no deprecation warnings, backward-compatible API 29 // 0 = no deprecation warnings, backward-compatible API
36 // 1 = make PointerHolder<T>(T*) explicit 30 // 1 = make PointerHolder<T>(T*) explicit
37 // 2 = warn for use of getPointer() and getRefcount() 31 // 2 = warn for use of getPointer() and getRefcount()
38 // 3 = warn for all use of PointerHolder 32 // 3 = warn for all use of PointerHolder
39 // 4 = don't define PointerHolder at all 33 // 4 = don't define PointerHolder at all
40 -# define POINTERHOLDER_TRANSITION 0 34 +# define POINTERHOLDER_TRANSITION 4
41 #endif // !defined(POINTERHOLDER_TRANSITION) 35 #endif // !defined(POINTERHOLDER_TRANSITION)
42 36
43 #if POINTERHOLDER_TRANSITION < 4 37 #if POINTERHOLDER_TRANSITION < 4
@@ -50,15 +44,19 @@ @@ -50,15 +44,19 @@
50 // interface and is mutually assignable with std::shared_ptr. Code 44 // interface and is mutually assignable with std::shared_ptr. Code
51 // that uses containers of PointerHolder will require adjustment. 45 // that uses containers of PointerHolder will require adjustment.
52 46
  47 +// In qpdf 11, a backward-compatible PointerHolder was provided with a
  48 +// warning if POINTERHOLDER_TRANSITION was not defined. Starting in
  49 +// qpdf 12, PointerHolder is absent if POINTERHOLDER_TRANSITION is not
  50 +// defined. In a future version of qpdf, PointerHolder will be removed
  51 +// outright if it becomes inconvenient to keep it around.
  52 +
53 // *** HOW TO TRANSITION *** 53 // *** HOW TO TRANSITION ***
54 54
55 // The symbol POINTERHOLDER_TRANSITION can be defined to help you 55 // The symbol POINTERHOLDER_TRANSITION can be defined to help you
56 // transition your code away from PointerHolder. You can define it 56 // transition your code away from PointerHolder. You can define it
57 // before including any qpdf header files or including its definition 57 // before including any qpdf header files or including its definition
58 // in your build configuration. If not defined, it automatically gets 58 // in your build configuration. If not defined, it automatically gets
59 -// defined to 0 (with a warning), which enables full backward  
60 -// compatibility. That way, you don't have to take action for your  
61 -// code to continue to work. 59 +// defined to 4, which excludes PointerHolder entirely.
62 60
63 // If you want to work gradually to transition your code away from 61 // If you want to work gradually to transition your code away from
64 // PointerHolder, you can define POINTERHOLDER_TRANSITION and fix the 62 // PointerHolder, you can define POINTERHOLDER_TRANSITION and fix the
@@ -123,7 +121,8 @@ @@ -123,7 +121,8 @@
123 121
124 // POINTERHOLDER_TRANSITION = 4 122 // POINTERHOLDER_TRANSITION = 4
125 // 123 //
126 -// Suppress definition of the PointerHolder<T> type entirely. 124 +// Suppress definition of the PointerHolder<T> type entirely. This is
  125 +// the default behavior starting with qpdf 12.
127 126
128 // CONST BEHAVIOR 127 // CONST BEHAVIOR
129 128
job.sums
1 # Generated by generate_auto_job 1 # Generated by generate_auto_job
2 -CMakeLists.txt 589283144c7c941ef96a12a7e57c354ec24d845657c919996867c60330501550 2 +CMakeLists.txt f0819695e4867e4f4389d38b0c124e79aa3ec9ace50f16ad8c751ff7f1ec6690
3 generate_auto_job f64733b79dcee5a0e3e8ccc6976448e8ddf0e8b6529987a66a7d3ab2ebc10a86 3 generate_auto_job f64733b79dcee5a0e3e8ccc6976448e8ddf0e8b6529987a66a7d3ab2ebc10a86
4 include/qpdf/auto_job_c_att.hh 4c2b171ea00531db54720bf49a43f8b34481586ae7fb6cbf225099ee42bc5bb4 4 include/qpdf/auto_job_c_att.hh 4c2b171ea00531db54720bf49a43f8b34481586ae7fb6cbf225099ee42bc5bb4
5 include/qpdf/auto_job_c_copy_att.hh 50609012bff14fd82f0649185940d617d05d530cdc522185c7f3920a561ccb42 5 include/qpdf/auto_job_c_copy_att.hh 50609012bff14fd82f0649185940d617d05d530cdc522185c7f3920a561ccb42
manual/design.rst
@@ -860,8 +860,8 @@ modification of code. @@ -860,8 +860,8 @@ modification of code.
860 860
861 The ``POINTERHOLDER_TRANSITION`` preprocessor symbol was introduced in 861 The ``POINTERHOLDER_TRANSITION`` preprocessor symbol was introduced in
862 qpdf 10.6.0 to help people transition from ``PointerHolder`` to 862 qpdf 10.6.0 to help people transition from ``PointerHolder`` to
863 -``std::shared_ptr``. If you don't define this, you will get a compiler  
864 -warning. Defining it to any value will suppress the warning. An 863 +``std::shared_ptr``. If you don't define this, ``PointerHolder`` will
  864 +be completely excluded from the API (starting with qpdf 12).An
865 explanation appears below of the different possible values for this 865 explanation appears below of the different possible values for this
866 symbol and what they mean. 866 symbol and what they mean.
867 867
@@ -1003,7 +1003,7 @@ without consulting this manual. @@ -1003,7 +1003,7 @@ without consulting this manual.
1003 - meaning 1003 - meaning
1004 1004
1005 - - undefined 1005 - - undefined
1006 - - Same as ``0`` but issues a warning 1006 + - Same as ``4``: ``PointerHolder`` is not defined.
1007 1007
1008 - - ``0`` 1008 - - ``0``
1009 - Provide a backward compatible ``PointerHolder`` and suppress 1009 - Provide a backward compatible ``PointerHolder`` and suppress
manual/release-notes.rst
@@ -29,6 +29,18 @@ Planned changes for future 12.x (subject to change): @@ -29,6 +29,18 @@ Planned changes for future 12.x (subject to change):
29 29
30 .. x.y.z: not yet released 30 .. x.y.z: not yet released
31 31
  32 +12.0.0: not yet released
  33 + - Build Changes
  34 +
  35 + - If ``POINTERHOLDER_TRANSITION`` is not defined, define it to
  36 + ``4``, which completely removes ``PointerHolder`` from the API.
  37 + Stop including it from any headers that used to include it. This
  38 + means code that hasn't completed its ``PointerHolder``
  39 + transition will get errors unless it defines
  40 + ``POINTERHOLDER_TRANSITION``, and any file that uses
  41 + ``PointerHolder`` will have to explicitly include it rather than
  42 + relying on other headers to bring it along.
  43 +
32 11.10.1: February 15, 2025 44 11.10.1: February 15, 2025
33 - Build fixes 45 - Build fixes
34 46
pkg-test/qpdf-version.cc
1 -#ifndef POINTERHOLDER_TRANSITION  
2 -# define POINTERHOLDER_TRANSITION 4  
3 -#endif  
4 -  
5 #include <qpdf/QPDF.hh> 1 #include <qpdf/QPDF.hh>
6 #include <iostream> 2 #include <iostream>
7 3