Jump to content

sc_fifo.h warnings with gcc -DNDEBUG


Recommended Posts

include/sysc/communication/sc_fifo.h:269:10: warning: unused variable ‘write_success’ [-Wunused-variable]
     bool write_success = sc_fifo<T>::nb_write(val_);
          
include/sysc/communication/sc_fifo.h:226:10: warning: unused variable ‘read_success’ [-Wunused-variable]
     bool read_success = sc_fifo<T>::nb_read(val_);

 

sc_fifo.h:

    bool write_success = sc_fifo<T>::nb_write(val_);
    sc_assert( write_success );

 

sc_report.h

#if defined(NDEBUG) && !defined(SC_ENABLE_ASSERTIONS) // disable assertions

#define sc_assert(expr) \
 ((void) 0)
 
 ....

i.e. expr is not addressed  when assertions are disabled

 

This is resolved with

#if defined(NDEBUG) && !defined(SC_ENABLE_ASSERTIONS) // disable assertions

#define sc_assert(expr) \
 ((void)(expr))
  
....

 

Link to post
Share on other sites

True. 

It means that the updates should be made to sc_fifo.h:

template <class T>
inline
void
sc_fifo<T>::read( T& val_ )
{
    while( num_available() == 0 ) {
	sc_core::wait( m_data_written_event );
    }
    bool read_success = sc_fifo<T>::nb_read(val_);

    if( !read_success ) {
       sc_assert( read_success );
    }
}

 

Link to post
Share on other sites
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...