view gcc/testsuite/g++.dg/torture/pr55740.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// { dg-do compile }

static bool st_IsPathDelimiter( char c ) { return c == '/'; }
bool IsValidPath( char const * filename )
{
  if ( !filename || filename[0] == 0 )     
    return false;
  char const * run = filename;
  while ( run && *run )       
    {
      if ( run[0] == '.' )   
	if ( run[1] != '.' || ( !st_IsPathDelimiter( run[2] ) && run[2] != 0 ) )   
	  return false;   
      while ( *run && !st_IsPathDelimiter( *run ) )
	++run;
      if ( *run ) 
	++run;
    }
}	// { dg-warning "control reaches end of non-void function" }