Gcc speaks about an error at line 438 on a file that have only 22x lines... 

Report:
gcc-output,
incriminated source file

In file included from surface.hpp:28,
                 from types.hpp:29,
                 from scene.hpp:28,
                 from scene_intro.hpp:31,
                 from scene_intro.cpp:26:
connecter.hpp:43: warning: `sigc::signal<T_return, T_arg1, T_arg2, T_arg3,
   T_arg4, T_arg5, T_arg6, T_arg7>::slot_type' is implicitly a typename
connecter.hpp:43: warning: implicit typename is deprecated, please see the
   documentation for details
/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h: In member function `
   typename sigc::functor_trait<T_functor,
   sigc::is_base_and_derived<sigc::functor_base,
   T_functor>::value>::result_type
   sigc::adaptor_functor<T_functor>::operator()() const [with T_functor =
   sigc::bound_mem_functor1<void, IntroScene, bool>]':
/usr/include/sigc++-2.0/sigc++/functors/slot.h:89:   instantiated from `static
T_return
sigc::internal::slot_call0<T_functor,T_return>::call_it(sigc::internal::slot_rep*)
[with T_functor = sigc::bound_mem_functor1<void, IntroScene, bool>, T_return =
void]'
/usr/include/sigc++-2.0/sigc++/functors/slot.h:96:   instantiated from `static
void*(* sigc::internal::slot_call0<T_functor, T_return>::address())(void*) [with
T_functor = sigc::bound_mem_functor1<void, IntroScene, bool>, T_return = void]'

[LOOK HERE]


scene_intro.cpp:438:   instantiated from here

[LOOK HERE]

/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:251: error: no match
   for call to `(sigc::bound_mem_functor1<void, IntroScene, bool>) ()'
/usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:1838: error: candidates are:
   T_return sigc::bound_mem_functor1<T_return, T_obj,
   T_arg1>::operator()(typename sigc::type_trait<T_arg3>::take) const [with
   T_return = void, T_obj = IntroScene, T_arg1 = bool]
/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:251: error: 
return-statement
   with a value, in function declared with a void return type

cc -c -o scene_intro.o `sdl-config --cflags` `pkg-config sigc++-2.0
--cflags`-I../SDL_Flic/ -I/usr/local/include/ -O   scene_intro.cpp


Then come the file scene_intro.cpp:

/***************************************************************************
 *                                                                         *
 *   This file is part of the Domini Terrae project                        *
 *                                                                         *
 *   Copyright (C) 2004 by Federico Tomassetti                             *
 *   [EMAIL PROTECTED]                                           *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include <cmath>
#include <SDL_image.h>
#include "scene_intro.hpp"
#include "scene_play.hpp"
#include "sdlutil.hpp"
#include "sdlttfutil.hpp"
#include "strutil.hpp"
#include "debug.hpp"
#include "global.hpp"
#include "datafinder.hpp"
#include "app.hpp"
#include "game.hpp"
#include "exit_codes.hpp"
#include "blink.hpp"

#include <iostream>
using namespace std;

static const int line_gap = 40;

IntroScene::IntroScene( unsigned int num_actions,
                const boost::signal<std::string ( unsigned int )>::slot_type& 
slot_get_text,
                const boost::signal<bool ( unsigned int )>::slot_type& 
slot_do_action,
                const boost::signal<void ()>::slot_type& slot_all_done )
try     : to_update_( true ), background_( NULL ),
                font_( NULL ), blinking_text_( NULL ), blink_( NULL ),
                done_( false ), completed_actions_( 0 ), num_actions_( 
num_actions ),
                img_done_( NULL )
{
        sig_need_text_.connect( slot_get_text );
        sig_do_action_.connect( slot_do_action );
        sig_all_done_.connect( slot_all_done );

        // load the background

        background_ = IMGCK_Load( Glob::datafinder()->find( "intro_background" 
) );
        
        SDL_Color color = color_create( 0x10, 0x15, 0xb5 );
        
        // blit lines & semi transparent texts on background
        
        SDL_Surface * img_line = IMGCK_Load( Glob::datafinder()->find( 
"intro_line" ) );
        font_ = TTFCK_OpenFont( Glob::datafinder()->find( "intro_font"), 20 );  
        for ( int i=0;i<num_actions_;i++ ) {
        
                // blit the line
        
                SDL_Rect dstrect_line = rect_create( 230, 200 + (line_gap*i),
                                0, 0 );
                SDLCK_BlitSurface( img_line, NULL, background_, &dstrect_line );
                
                // obtain the string
                
                string text = sig_need_text_( i );
                
                // render the string
                
                SDL_Surface * rendered = TTFCK_RenderText_Blended( font_, 
text.c_str(), color );
                
                // save it as opaque
                
                opaque_texts_.push_back( rendered );
                
                // copy & alphize it
                
                SDL_Surface * alphized = surface_copy( rendered );
                if ( !surface_alphize( alphized, 90 ) ) {
                        App::prog_warning( "Text not alphized" );
                }
                
                // blit it alphized
                
                SDL_Rect dstrect_text = rect_create( 240, 215 + (line_gap*i),
                                0, 0 );
                SDLCK_BlitSurface( alphized, NULL, background_, &dstrect_text );
                
                SDL_FreeSurface( alphized );
        }
        SDL_FreeSurface( img_line );
        
        img_done_ = IMGCK_Load( Glob::datafinder()->find( "intro_done" ) );
        
        blinking_text_ = new Surface( TTFCK_RenderText_Blended( font_, 
                        "press any key to start the game",
                        color_create( 0xff, 0, 0 ) ) );
        
} catch ( const SDL_Failure& ex ) {
        App::debug_info( "SDL_Failure creating IntroScene" );
        throw;
}

IntroScene::~IntroScene()
{
        if ( blinking_text_ ) delete blinking_text_;
        if ( blink_ ) delete blink_;
        if ( img_done_ ) SDL_FreeSurface( img_done_ );
        if ( font_ ) TTF_CloseFont( font_ );
        if ( background_ ) SDL_FreeSurface( background_ );
}

void IntroScene::key_pressed( SDLKey key )
{
        static bool done_sent = false;
        if ( done_ && !done_sent ) {
                sig_all_done_();
                done_sent = true;
        }
}

void IntroScene::mouse_pressed( Uint8 button, uint mouse_x, uint mouse_y )
{
}

void IntroScene::mouse_released( Uint8 button, uint mouse_x, uint mouse_y )
{
}

void IntroScene::mouse_moved( uint mouse_x, uint mouse_y )
{
}

void IntroScene::key_released( SDLKey )
{
}

RectsVector IntroScene::update()
try {
        RectsVector rects;
        
        // if we don't need to update, nothing to do
        
        if ( !to_update_ ) return rects;
        IAMHERE;
        SDL_Surface * fb = Video::inst()->get_framebuffer();
        IAMHERE;
        SDLCK_BlitSurface( background_, NULL, fb, NULL );
        IAMHERE;
        rects.push_back( rect_create( 0, 0, fb->w, fb->h ) );
        IAMHERE;
        to_update_ = false;
        return rects;
} catch ( const SDL_Failure& ex ) {
        App::comunicate_error( string( "IntroScene::update(): An SDL function 
failed: " )
                        + ex.function_ + string( " error: " ) + ex.error_ );
}

void IntroScene::act()
try {

        if ( completed_actions_ < num_actions_ ) {
                SDL_Surface * fb = Video::inst()->get_framebuffer();
                        
                SDL_Rect dstrect_text = rect_create( 240, 215 + 
(line_gap*completed_actions_), 
                                0, 0 );
                SDL_Rect dstrect_done = rect_create( 500, 200 + 
(line_gap*completed_actions_), 
                                0, 0 );
                
                // blit opaque text
                
                SDLCK_BlitSurface( opaque_texts_[ completed_actions_ ], NULL, 
fb, &dstrect_text );
                SDL_FreeSurface( opaque_texts_[ completed_actions_ ] );
                
                sig_do_action_( completed_actions_ );
                
                // blit done img
                
                SDLCK_BlitSurface( img_done_, NULL, fb, &dstrect_done );
        
                completed_actions_++;
        } else if ( completed_actions_== num_actions_ ) {
        
                // start blink
        
                SDL_Color color = color_create( 0xD0, 0x35, 0x35 );     
                blinking_text_ = new Surface( TTFCK_RenderText_Blended( font_, 
"Press a key to
continue",
                                color ) );
                
                blink_ = new Blink( blinking_text_, 400 );
                SDL_Rect saved_rect = rect_create( 400 - 
(blinking_text_->get()->w/2), 450,
                                400 + (blinking_text_->get()->w/2), 
blinking_text_->get()->h );
                saved_.save( background_, &saved_rect );
                sigc::slot<void> slot = sigc::mem_fun( this, 
&IntroScene::slot_blink );
                blink_->conn_changed_.connect( slot );
                
                // set done flag
                
                done_ = true;
        }
} catch ( const SDL_Failure& ex ) {
        App::comunicate_error( string( "IntroScene::act(): An SDL function 
failed: " )
                        + ex.function_ + string( " error: " ) + ex.error_ );
} 

void IntroScene::slot_blink( bool blitted )
{
        SDL_Rect rect = rect_create( 400 - (blinking_text_->get()->w/2), 450,
                        400 + (blinking_text_->get()->w/2), 
blinking_text_->get()->h );
        if ( blitted ) {
                SDLCK_BlitSurface( background_, &rect, blinking_text_->get(), 
NULL );
        } else {
                saved_.restore( background_, &rect );
        }
        to_update_ = true;
}

-- 
           Summary: Error signale on an unexisting line
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: federicotomassetti at yahoo dot it
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18829

Reply via email to