Mercurial > octave
annotate libinterp/octave-value/ov-uint64.cc @ 24224:ff81c6772664
avoid issue with link-time optimization
With link-time optimization, the value used for the HDF5 save type was
not working correctly for Octave int types. It seems that the
templated load and save functions were recognized as duplicates and
only one version was used, even though they needed to be different.
This patch attempts to avoid that.
* ov-base-int.h, ov-base-int.cc
(octave_base_int<T>::load_hdf5_internal): Rename from
octave_base_int<T>::load_hdf5. Pass HDF5 save type as arg.
(octave_base_int<T>::save_hdf5_internal): Rename from
octave_base_int<T>::save_hdf5. Pass HDF5 save type as arg.
* ov-intx.h (OCTAVE_VALUE_INT_MATRIX_T::load_hdf5,
OCTAVE_VALUE_INT_MATRIX_T::save_hdf5,
OCTAVE_VALUE_INT_SCALAR_T:load_hdf5,
OCTAVE_VALUE_INT_SCALAR_T:save_hdf5): New declarations.
* ov-int16.cc, ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-uint16.cc,
ov-uint32.cc, ov-uint64.cc, ov-uint8.cc: Define load_hdf5 and
save_hdf5 functions.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 09 Nov 2017 18:20:19 -0500 |
parents | 092078913d54 |
children | b8cb5a05955e |
rev | line source |
---|---|
4901 | 1 /* |
2 | |
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23083
diff
changeset
|
3 Copyright (C) 2004-2017 John W. Eaton |
4901 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
9 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
10 (at your option) any later version. |
4901 | 11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
15 GNU General Public License for more details. |
4901 | 16 |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
4901 | 20 |
21 */ | |
22 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21574
diff
changeset
|
23 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
24 # include "config.h" |
4901 | 25 #endif |
26 | |
27 #include <iostream> | |
15215
9020dddc925a
use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
28 #include <limits> |
4901 | 29 |
30 #include "lo-ieee.h" | |
31 #include "lo-utils.h" | |
32 #include "mx-base.h" | |
33 #include "quit.h" | |
34 | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
35 #include "errwarn.h" |
4901 | 36 #include "oct-lvalue.h" |
19863
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
37 #include "oct-hdf5.h" |
4901 | 38 #include "ops.h" |
39 #include "ov-base.h" | |
4917 | 40 |
20257
d54aa96abadf
Fix load/save of integers with -hdf5 (bug #45225)
Mike Miller <mtmiller@octave.org>
parents:
19863
diff
changeset
|
41 #if defined (HAVE_HDF5) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
42 # define HDF5_SAVE_TYPE H5T_NATIVE_UINT64 |
24224
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
43 #else |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
44 // This value will not be used. |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
45 # define HDF5_SAVE_TYPE 0 |
20257
d54aa96abadf
Fix load/save of integers with -hdf5 (bug #45225)
Mike Miller <mtmiller@octave.org>
parents:
19863
diff
changeset
|
46 #endif |
d54aa96abadf
Fix load/save of integers with -hdf5 (bug #45225)
Mike Miller <mtmiller@octave.org>
parents:
19863
diff
changeset
|
47 |
4901 | 48 #include "ov-base-int.h" |
49 #include "ov-base-int.cc" | |
50 #include "ov-uint64.h" | |
51 #include "pr-output.h" | |
52 #include "variables.h" | |
53 | |
54 #include "byte-swap.h" | |
20447
c6224b4e7774
maint: Rename instances of LS_ASCII to LS_TEXT for clarity.
Rik <rik@octave.org>
parents:
20257
diff
changeset
|
55 #include "ls-oct-text.h" |
4901 | 56 #include "ls-utils.h" |
57 #include "ls-hdf5.h" | |
58 | |
21573
f3f8e1d3e399
avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents:
20257
diff
changeset
|
59 // Prevent implicit instantiations on some systems (Windows, others?) |
f3f8e1d3e399
avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents:
20257
diff
changeset
|
60 // that can lead to duplicate definitions of static data members. |
f3f8e1d3e399
avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents:
20257
diff
changeset
|
61 |
f3f8e1d3e399
avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents:
20257
diff
changeset
|
62 extern template class OCTINTERP_API octave_base_scalar<double>; |
f3f8e1d3e399
avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents:
20257
diff
changeset
|
63 |
4901 | 64 template class octave_base_matrix<uint64NDArray>; |
65 | |
66 template class octave_base_int_matrix<uint64NDArray>; | |
67 | |
68 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint64_matrix, | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
69 "uint64 matrix", "uint64"); |
4901 | 70 |
24224
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
71 bool |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
72 octave_uint64_matrix::save_hdf5 (octave_hdf5_id loc_id, const char *name, |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
73 bool flag) |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
74 { |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
75 return save_hdf5_internal (loc_id, HDF5_SAVE_TYPE, name, flag); |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
76 } |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
77 |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
78 bool |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
79 octave_uint64_matrix::load_hdf5 (octave_hdf5_id loc_id, const char *name) |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
80 { |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
81 return load_hdf5_internal (loc_id, HDF5_SAVE_TYPE, name); |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
82 } |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
83 |
4901 | 84 template class octave_base_scalar<octave_uint64>; |
85 | |
86 template class octave_base_int_scalar<octave_uint64>; | |
87 | |
88 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint64_scalar, | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
89 "uint64 scalar", "uint64"); |
24224
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
90 |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
91 bool |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
92 octave_uint64_scalar::save_hdf5 (octave_hdf5_id loc_id, const char *name, |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
93 bool flag) |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
94 { |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
95 return save_hdf5_internal (loc_id, HDF5_SAVE_TYPE, name, flag); |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
96 } |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
97 |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
98 bool |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
99 octave_uint64_scalar::load_hdf5 (octave_hdf5_id loc_id, const char *name) |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
100 { |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
101 return load_hdf5_internal (loc_id, HDF5_SAVE_TYPE, name); |
ff81c6772664
avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
102 } |