Coder Social home page Coder Social logo

Comments (2)

0x804d8000 avatar 0x804d8000 commented on May 18, 2024

应该跟https://github.com/Tencent/yadcc/blob/master/yadcc/daemon/cloud/remote_task/cxx_compilation_task.cc#L46 有关,为了降低客户机负载,对这些宏的检查挪到了编译机。如果代码中出现了这些宏的话就会不缓存。

YADCC_WARN_ON_NONCACHEABLE检测不到这个case,后续我会更新一下文档(其实最好是从编译机回传相关信息,后续有时间再看看)。另外有个regression是YADCC_IGNORE_TIMESTAMP_MACROS失效了,回头得改下协议。

如果宏出现在头文件,建议避免,因为这是个正确性问题,所以各类编译缓存对这些宏都会比较保守。如果出现在.cc,其他文件应该还是可以缓存的。

为了确认这一问题,可以加编译参数-E并观察输出是不是有类似的宏的使用。


另外,有一个特殊处理,就是如果编译参数有-D__DATE__="redacted" -D__TIMESTAMP__="redacted" -D__TIME__="redacted",会特判这个case允许缓存,可以加在编译参数试一下。

这个我印象里其实是个UB,但是bazel默认会有这个参数,为了强制代码不要依赖这些宏(印象里好像是为了reproducible build)。腾讯广告内部的blade配置也加了类似的参数。你也可以看看你的环境里需不需要采用这种方式。

注:只要代码中实际没出现这些宏,这个参数加与不加不会有区别。这个更多的是一种用于确保编码规范的措施。

from yadcc.

frankfif avatar frankfif commented on May 18, 2024

谢谢,从业务代码中,我看到包含__DATE__、TIMESTAMPTIME__这类的宏定义在头文件中,因此缓存没有生效,麻烦后续修改一下YADCC_IGNORE_TIMESTAMP_MACROS就可以了,经过测试,增加编译参数:-D__DATE="redacted" -D__TIMESTAMP_="redacted" -D__TIME__="redacted",是可以正常缓存的。

from yadcc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.