[Cmake-commits] [cmake-commits] king committed cmCMakeMinimumRequired.cxx 1.19 1.20 cmExecuteProcessCommand.cxx 1.10 1.11 cmFileCommand.cxx 1.135 1.136 cmFindPackageCommand.cxx 1.61 1.62 cmPolicies.cxx 1.43 1.44 cmSetCommand.cxx 1.36 1.37 cmSystemTools.cxx 1.400 1.401 cmUtilitySourceCommand.cxx 1.25 1.26

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Sep 11 08:18:19 EDT 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv1018/Source

Modified Files:
	cmCMakeMinimumRequired.cxx cmExecuteProcessCommand.cxx 
	cmFileCommand.cxx cmFindPackageCommand.cxx cmPolicies.cxx 
	cmSetCommand.cxx cmSystemTools.cxx cmUtilitySourceCommand.cxx 
Log Message:
Add parentheses around '&&' between '||' for gcc

The GNU compiler warns about possible operator precedence mistakes and
asks for explicit parentheses (-Wparentheses).  We add the parentheses
to silence the warning.  This also fixes one real logic error in the
find_package() implementation by correcting expression evaluation order.


Index: cmPolicies.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmPolicies.cxx,v
retrieving revision 1.43
retrieving revision 1.44
diff -C 2 -d -r1.43 -r1.44
*** cmPolicies.cxx	10 Sep 2009 20:59:44 -0000	1.43
--- cmPolicies.cxx	11 Sep 2009 12:18:08 -0000	1.44
***************
*** 498,502 ****
    
    // it is an error if the policy version is less than 2.4
!   if (majorVer < 2 || majorVer == 2 && minorVer < 4)
      {
      mf->IssueMessage(cmake::FATAL_ERROR,
--- 498,502 ----
    
    // it is an error if the policy version is less than 2.4
!   if (majorVer < 2 || (majorVer == 2 && minorVer < 4))
      {
      mf->IssueMessage(cmake::FATAL_ERROR,

Index: cmUtilitySourceCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmUtilitySourceCommand.cxx,v
retrieving revision 1.25
retrieving revision 1.26
diff -C 2 -d -r1.25 -r1.26
*** cmUtilitySourceCommand.cxx	23 Jan 2008 15:27:59 -0000	1.25
--- cmUtilitySourceCommand.cxx	11 Sep 2009 12:18:15 -0000	1.26
***************
*** 57,61 ****
      haveCacheValue = (cacheValue &&
       (strstr(cacheValue, "(IntDir)") == 0 ||
!       intDir && strcmp(intDir, "$(IntDir)") == 0) &&
       (this->Makefile->GetCacheMajorVersion() != 0 &&
        this->Makefile->GetCacheMinorVersion() != 0 ));
--- 57,61 ----
      haveCacheValue = (cacheValue &&
       (strstr(cacheValue, "(IntDir)") == 0 ||
!       (intDir && strcmp(intDir, "$(IntDir)") == 0)) &&
       (this->Makefile->GetCacheMajorVersion() != 0 &&
        this->Makefile->GetCacheMinorVersion() != 0 ));

Index: cmSystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSystemTools.cxx,v
retrieving revision 1.400
retrieving revision 1.401
diff -C 2 -d -r1.400 -r1.401
*** cmSystemTools.cxx	13 Jul 2009 21:08:38 -0000	1.400
--- cmSystemTools.cxx	11 Sep 2009 12:18:13 -0000	1.401
***************
*** 511,520 ****
    bool win_path = false;
  
!   if ( command[0] != '/' && command[1] == ':' && command[2] == '\\' ||
!        command[0] == '\"' && command[1] != '/' && command[2] == ':' 
!        && command[3] == '\\' || 
!        command[0] == '\'' && command[1] != '/' && command[2] == ':' 
!        && command[3] == '\\' || 
!        command[0] == '\\' && command[1] == '\\')
      {
      win_path = true;
--- 511,520 ----
    bool win_path = false;
  
!   if ((command[0] != '/' && command[1] == ':' && command[2] == '\\') ||
!       (command[0] == '\"' && command[1] != '/' && command[2] == ':'
!        && command[3] == '\\') ||
!       (command[0] == '\'' && command[1] != '/' && command[2] == ':'
!        && command[3] == '\\') ||
!       (command[0] == '\\' && command[1] == '\\'))
      {
      win_path = true;

Index: cmFileCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.cxx,v
retrieving revision 1.135
retrieving revision 1.136
diff -C 2 -d -r1.135 -r1.136
*** cmFileCommand.cxx	6 Sep 2009 17:24:56 -0000	1.135
--- cmFileCommand.cxx	11 Sep 2009 12:18:03 -0000	1.136
***************
*** 591,595 ****
        // Ignore CR character to make output always have UNIX newlines.
        }
!     else if(c >= 0x20 && c < 0x7F || c == '\t' || c == '\f' ||
              (c == '\n' && newline_consume))
        {
--- 591,595 ----
        // Ignore CR character to make output always have UNIX newlines.
        }
!     else if((c >= 0x20 && c < 0x7F) || c == '\t' || c == '\f' ||
              (c == '\n' && newline_consume))
        {
***************
*** 1974,1978 ****
        {
        int relative = 0;
!       if ( ( ch1 >= 'a' && ch1 <= 'z' || ch1 >= 'A' && ch1 <= 'Z' ) &&
               ch2 == ':' )
          {
--- 1974,1978 ----
        {
        int relative = 0;
!       if (((ch1 >= 'a' && ch1 <= 'z') || (ch1 >= 'A' && ch1 <= 'Z')) &&
               ch2 == ':' )
          {

Index: cmFindPackageCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindPackageCommand.cxx,v
retrieving revision 1.61
retrieving revision 1.62
diff -C 2 -d -r1.61 -r1.62
*** cmFindPackageCommand.cxx	1 Sep 2009 18:04:27 -0000	1.61
--- cmFindPackageCommand.cxx	11 Sep 2009 12:18:07 -0000	1.62
***************
*** 901,905 ****
  
    // Search for frameworks.
!   if(!found && this->SearchFrameworkFirst || this->SearchFrameworkOnly)
      {
      found = this->FindFrameworkConfig();
--- 901,905 ----
  
    // Search for frameworks.
!   if(!found && (this->SearchFrameworkFirst || this->SearchFrameworkOnly))
      {
      found = this->FindFrameworkConfig();
***************
*** 907,911 ****
  
    // Search for apps.
!   if(!found && this->SearchAppBundleFirst || this->SearchAppBundleOnly)
      {
      found = this->FindAppBundleConfig();
--- 907,911 ----
  
    // Search for apps.
!   if(!found && (this->SearchAppBundleFirst || this->SearchAppBundleOnly))
      {
      found = this->FindAppBundleConfig();
***************
*** 1137,1142 ****
  
        // If the path is a PREFIX/bin case then add its parent instead.
!       if(d.size() >= 4 && strcmp(d.c_str()+d.size()-4, "/bin") == 0 ||
!          d.size() >= 5 && strcmp(d.c_str()+d.size()-5, "/sbin") == 0)
          {
          this->AddPathInternal(cmSystemTools::GetFilenamePath(d), EnvPath);
--- 1137,1142 ----
  
        // If the path is a PREFIX/bin case then add its parent instead.
!       if((d.size() >= 4 && strcmp(d.c_str()+d.size()-4, "/bin") == 0) ||
!          (d.size() >= 5 && strcmp(d.c_str()+d.size()-5, "/sbin") == 0))
          {
          this->AddPathInternal(cmSystemTools::GetFilenamePath(d), EnvPath);

Index: cmSetCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSetCommand.cxx,v
retrieving revision 1.36
retrieving revision 1.37
diff -C 2 -d -r1.36 -r1.37
*** cmSetCommand.cxx	10 Sep 2009 20:59:44 -0000	1.36
--- cmSetCommand.cxx	11 Sep 2009 12:18:12 -0000	1.37
***************
*** 135,141 ****
    // next to last args are CACHE then they screwed up.  If they used FORCE
    // without CACHE they screwed up
!   if (args[args.size() - 1] == "CACHE" ||
!       args.size() > 1 && args[args.size() - 2] == "CACHE" ||
!       force && !cache)
      {
      this->SetError("given invalid arguments for CACHE mode.");
--- 135,141 ----
    // next to last args are CACHE then they screwed up.  If they used FORCE
    // without CACHE they screwed up
!   if ((args[args.size() - 1] == "CACHE") ||
!       (args.size() > 1 && args[args.size() - 2] == "CACHE") ||
!       (force && !cache))
      {
      this->SetError("given invalid arguments for CACHE mode.");

Index: cmExecuteProcessCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmExecuteProcessCommand.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -C 2 -d -r1.10 -r1.11
*** cmExecuteProcessCommand.cxx	23 Jan 2008 15:27:59 -0000	1.10
--- cmExecuteProcessCommand.cxx	11 Sep 2009 12:18:00 -0000	1.11
***************
*** 299,304 ****
      {
      // Put the output in the right place.
!     if(p == cmsysProcess_Pipe_STDOUT && !output_quiet ||
!        p == cmsysProcess_Pipe_STDERR && !error_quiet && merge_output)
        {
        if(output_variable.empty())
--- 299,304 ----
      {
      // Put the output in the right place.
!     if((p == cmsysProcess_Pipe_STDOUT && !output_quiet) ||
!        (p == cmsysProcess_Pipe_STDERR && !error_quiet && merge_output))
        {
        if(output_variable.empty())

Index: cmCMakeMinimumRequired.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCMakeMinimumRequired.cxx,v
retrieving revision 1.19
retrieving revision 1.20
diff -C 2 -d -r1.19 -r1.20
*** cmCMakeMinimumRequired.cxx	3 Jan 2009 20:47:58 -0000	1.19
--- cmCMakeMinimumRequired.cxx	11 Sep 2009 12:18:00 -0000	1.20
***************
*** 88,97 ****
  
    // Compare the version numbers.
!   if(current_major < required_major ||
!      current_major == required_major &&
!      current_minor < required_minor ||
!      current_major == required_major &&
!      current_minor == required_minor &&
!      current_patch < required_patch)
      {
      // The current version is too low.
--- 88,97 ----
  
    // Compare the version numbers.
!   if((current_major < required_major) ||
!      (current_major == required_major &&
!       current_minor < required_minor) ||
!      (current_major == required_major &&
!       current_minor == required_minor &&
!       current_patch < required_patch))
      {
      // The current version is too low.
***************
*** 111,115 ****
      }
  
!   if (required_major < 2 || required_major == 2 && required_minor < 4)
    {
      this->Makefile->SetPolicyVersion("2.4");
--- 111,115 ----
      }
  
!   if (required_major < 2 || (required_major == 2 && required_minor < 4))
    {
      this->Makefile->SetPolicyVersion("2.4");



More information about the Cmake-commits mailing list