[cmake-developers] Automoc same source - More thoughts

Brad King brad.king at kitware.com
Thu Apr 14 08:36:25 EDT 2016


On 04/12/2016 03:12 PM, Sebastian Holtermann wrote:
> Here it is. Please review/commit.

Thanks.

> -    subDir = absPath
> -                  + cmsys::SystemTools::GetFilenamePath(currentMoc) + '/';
> +    std::string fileNamePath = cmsys::SystemTools::GetFilenamePath(currentMoc);
> +    if ( fileNamePath.find ( ".." ) == std::string::npos )
> +      {
> +        subDir = absPath + fileNamePath + '/';
> +      }
> +    else
> +      {
> +      // We can't handle parent directories
> +      std::cerr << "AUTOGEN: error: moc include \"" << currentMoc
> +                << "\" contains parent directory reference \"..\""
> +                << std::endl;
> +      ::exit(EXIT_FAILURE);
> +      }
[snip]
> +  // Check: Look for name collisions
> +    {
> +    typedef std::map<std::string, std::string>::const_iterator Iter;
> +    for ( Iter ita = includedMocs.begin(); ita != includedMocs.end(); ++ita )
> +      {
> +      Iter itb = ita;
> +      ++itb;
> +      for ( ; itb != includedMocs.end(); ++itb )
> +        {
> +        if ( ita->second == itb->second )
> +          {
> +          std::cerr << "AUTOGEN: error: moc name collision" << std::endl
> +                    << ita->first << " -> " << ita->second << std::endl
> +                    << itb->first << " -> " << itb->second << std::endl;
> +          ::exit(EXIT_FAILURE);
> +          }
> +        }
> +      }
> +    }
> +

These two hunks look like error checks added to the existing logic.
Please split these out into preceding commits with their own messages
explaining the new errors.  Please also include a

 Help/release/dev/automoc-diagnostics.rst

file with a release note explaining the new diagnostics.

Thanks,
-Brad



More information about the cmake-developers mailing list