Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to fix C++ depreciated isDisabled()

Posted on 2008-11-03
4
Medium Priority
?
832 Views
Last Modified: 2012-05-05
I downloaded source code for project "job-scheduler" from SourceForge.net (http://sourceforge.net/projects/job-scheduler).  When I ran the "configure", a message indicated I had to install ZThread-2.3.2 from SourceForge (http://sourceforge.net/projects/zthread/).  

I am attempting to compile ZThread-2.3.2. When I do a "make install" on my ubuntu box, I get an error message that  C++ function isDisabled() is depreciated in header Guard.h.  The "make install"  messages said: "if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated".  I assume I can also fix the problem in Guard.h.  But I do not know how do do either!

Can someone please help with either solution?

Part of the "make install" messages is in the code snippet section.  Also below that are the two references to isDisabled() in Guard.h

g++ -DHAVE_CONFIG_H -I. -I. -I. -I../include -g -O2 -Wall -DNDEBUG -g -O2 -Wall -DNDEBUG -MT AtomicCount.lo -MD -MP -MF .deps/AtomicCount.Tpo -c AtomicCount.cxx  -fPIC -DPIC -o .libs/AtomicCount.o
In file included from vanilla/SimpleAtomicCount.cxx:26,
                 from AtomicCount.cxx:55:
../include/zthread/Guard.h: In destructor 'ZThread::Guard<LockType, LockingPolicy>::~Guard()':
../include/zthread/Guard.h:494: error: there are no arguments to 'isDisabled' that depend on a template parameter, so a declaration of 'isDisabled' must be available
../include/zthread/Guard.h:494: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
make[2]: *** [AtomicCount.lo] Error 1
make[2]: Leaving directory `/home/marv/ZThread-2.3.2/src'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/marv/ZThread-2.3.2/src'
make: *** [install-recursive] Error 1
 
 
Guard.h
--------
bool isDisabled() {
  return !_enabled;
}
 
 
 
template <class LockType, class LockingPolicy>
Guard<LockType, LockingPolicy>::~Guard() throw() {
    
  try {
    
    if(!isDisabled())
      LockingPolicy::destroyScope(*this);
    
  } catch (...) { /* ignore */ }  
  
}

Open in new window

0
Comment
Question by:IT79637
  • 2
4 Comments
 
LVL 1

Author Comment

by:IT79637
ID: 22870964
0
 
LVL 1

Author Comment

by:IT79637
ID: 22871044
More info.  Can anything be done with this:
http://aur.archlinux.org/packages/zthread/zthread/PKGBUILD


# Contributor: Travis Willard <travisw@wmpub.ca>

pkgname=zthread
pkgver=2.3.2
pkgrel=1
pkgdesc="A platform-independent, multi-threading and synchronization library for C++"
url="http://zthread.sourceforge.net"
license="MIT"
depends=(gcc)
makedepends=()
conflicts=()
source=(http://dl.sourceforge.net/zthread/ZThread-$pkgver.tar.gz zthread-gcc4.patch)  <<-- I tried to download this but got an http 404 error.

build() {
    cd $startdir/src/ZThread-$pkgver/

    ./configure --prefix=/usr || return 1

    patch -Np1 < $startdir/src/zthread-gcc4.patch || return 1

    make || return 1
    make prefix=$startdir/pkg/usr install || return 1

    # Libtool slay
    find $startdir/pkg -name "*.la" -exec rm {} \;

    # Install license (required for MIT licenses)
    install -d $startdir/pkg/usr/share/licenses/$pkgname
    install -m0644 LICENSE $startdir/pkg/usr/share/licenses/$pkgname/license.txt

}

0
 
LVL 2

Accepted Solution

by:
aaronblum earned 450 total points
ID: 22871109
job-scheduler is still in an Alpha release if I am not mistaken so my immediate question is are you sure you want to use job-scheduler?  What are you trying to do?

As for fixing it, I would say make modifications as necessary in the job-scheduler code (as it looks kind of abandoned - last release Dec 2004) rather than Zthread which is in a more stable 2005 release.  If you still want to proceed with code modifications let me know and I'll do my best to point you in the right direction.

Otherwise, for job scheduling, in a unix-like environment, I strongly recommend the use of cron.  There is a good page on cron usage here: http://www.unixgeeks.org/security/newbie/unix/cron-1.html
0
 
LVL 86

Assisted Solution

by:jkr
jkr earned 450 total points
ID: 22871238
It seems that this line should be


template <class LockType, class LockingPolicy>
Guard<LockType, LockingPolicy>::~Guard() throw() {
    
  try {
    
    if(!LockHolder<LockType>::isDisabled())
      LockingPolicy::destroyScope(*this);
    
  } catch (...) { /* ignore */ }  
  
}

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question