comparison liboctave/array/Range.h @ 29954:4c88a452519c

rename OCTAVE_USE_DEPRECATED_FUNCTIONS macro and attempt to make it work For ordinary functions declared in a header file and defined in a corresponding source file, it should be OK to omit the declaration in the header file based on the value of OCTAVE_PROVIDE_DEPRECATED_SYMBOLS. But it is an error to attempt to define a member function that has not been declared in the class declaration. So for these, we rename the original function to be FOO_deprecated and then provide a wrapper function called FOO that is completely defined in the header file and simply calls the FOO_deprecated function. * mk-octave-config-h.sh, oct-conf-post.in.h (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS): Rename from OCTAVE_USE_DEPRECATED_FUNCTIONS. Change all uses. For deprecated member fucntions, use private FOO_deprecated member functions and conditionally defined inline public wrappers to allow declarations of deprecated symbosl to be omitted if OCTAVE_PROVIDE_DEPRECATED_SYMBOLS is not defined.
author John W. Eaton <jwe@octave.org>
date Sat, 14 Aug 2021 11:13:17 -0400
parents 29a1f8fd8ee6
children e424d966dca7
comparison
equal deleted inserted replaced
29953:e35442c969f5 29954:4c88a452519c
373 class 373 class
374 Range 374 Range
375 { 375 {
376 public: 376 public:
377 377
378 #if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
378 OCTAVE_DEPRECATED (7, "use the 'octave::range<double>' class instead") 379 OCTAVE_DEPRECATED (7, "use the 'octave::range<double>' class instead")
379 Range (void) 380 Range (void)
380 : m_base (0), m_limit (0), m_inc (0), m_numel (0) 381 : m_base (0), m_limit (0), m_inc (0), m_numel (0)
381 { } 382 { }
382 383
388 OCTAVE_DEPRECATED (7, "use the 'octave::range<double>' class instead") 389 OCTAVE_DEPRECATED (7, "use the 'octave::range<double>' class instead")
389 Range (const octave::range<double>& r) 390 Range (const octave::range<double>& r)
390 : m_base (r.base ()), m_limit (r.final_value ()), m_inc (r.increment ()), 391 : m_base (r.base ()), m_limit (r.final_value ()), m_inc (r.increment ()),
391 m_numel (r.numel ()) 392 m_numel (r.numel ())
392 { } 393 { }
394 #endif
393 395
394 Range (const Range& r) = default; 396 Range (const Range& r) = default;
395 397
396 Range& operator = (const Range& r) = default; 398 Range& operator = (const Range& r) = default;
397 399
398 ~Range (void) = default; 400 ~Range (void) = default;
399 401
402 #if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
400 OCTAVE_DEPRECATED (7, "use the 'octave::range<double>' class instead") 403 OCTAVE_DEPRECATED (7, "use the 'octave::range<double>' class instead")
401 Range (double b, double l) 404 Range (double b, double l)
402 : m_base (b), m_limit (l), m_inc (1), m_numel (numel_internal ()) 405 : m_base (b), m_limit (l), m_inc (1), m_numel (numel_internal ())
403 { 406 {
404 if (! octave::math::isinf (m_limit)) 407 if (! octave::math::isinf (m_limit))
424 : m_base (b), m_limit (b + (n-1) * i), m_inc (i), m_numel (n) 427 : m_base (b), m_limit (b + (n-1) * i), m_inc (i), m_numel (n)
425 { 428 {
426 if (! octave::math::isinf (m_limit)) 429 if (! octave::math::isinf (m_limit))
427 m_limit = limit_internal (); 430 m_limit = limit_internal ();
428 } 431 }
432 #endif
429 433
430 // The range has a finite number of elements. 434 // The range has a finite number of elements.
431 bool ok (void) const 435 bool ok (void) const
432 { 436 {
433 return (octave::math::isfinite (m_limit) 437 return (octave::math::isfinite (m_limit)
535 Range (double b, double l, double i, octave_idx_type n) 539 Range (double b, double l, double i, octave_idx_type n)
536 : m_base (b), m_limit (l), m_inc (i), m_numel (n) 540 : m_base (b), m_limit (l), m_inc (i), m_numel (n)
537 { } 541 { }
538 }; 542 };
539 543
544 #if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
540 OCTAVE_DEPRECATED (7, "arithmetic operations on Range objects are unreliable") 545 OCTAVE_DEPRECATED (7, "arithmetic operations on Range objects are unreliable")
541 extern OCTAVE_API Range operator - (const Range& r); 546 extern OCTAVE_API Range operator - (const Range& r);
542 547
543 OCTAVE_DEPRECATED (7, "arithmetic operations on Range objects are unreliable") 548 OCTAVE_DEPRECATED (7, "arithmetic operations on Range objects are unreliable")
544 extern OCTAVE_API Range operator + (double x, const Range& r); 549 extern OCTAVE_API Range operator + (double x, const Range& r);
555 OCTAVE_DEPRECATED (7, "arithmetic operations on Range objects are unreliable") 560 OCTAVE_DEPRECATED (7, "arithmetic operations on Range objects are unreliable")
556 extern OCTAVE_API Range operator * (double x, const Range& r); 561 extern OCTAVE_API Range operator * (double x, const Range& r);
557 562
558 OCTAVE_DEPRECATED (7, "arithmetic operations on Range objects are unreliable") 563 OCTAVE_DEPRECATED (7, "arithmetic operations on Range objects are unreliable")
559 extern OCTAVE_API Range operator * (const Range& r, double x); 564 extern OCTAVE_API Range operator * (const Range& r, double x);
560
561 #endif 565 #endif
566
567 #endif