New issue
Advanced search Search tips

Issue 649899 link

Starred by 2 users

Issue metadata

Status: Archived
Owner: ----
Closed: Oct 2017
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

GN: Missing precompiled_header_type silently generates incorrect Ninja files

Reported by t...@rnc-ag.de, Sep 24 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0

Steps to reproduce the problem:
Simple PoC (this uses the toolchain in //tools/gn/example):

config("precompiled_headers") {
  precompiled_header = "build/precompile.h"
  precompiled_source = "//build/precompile.h"
}

executable("hello") {
  sources = [
    "hello.cc",
  ]

  cflags_cc = [ "-std=gnu++14" ]

  # If the following line is uncommented, the generated
  # hello.ninja's cflags_cc variable will be empty (instead of -std=gnu++14).
  configs += [ ":precompiled_headers" ]
}

What is the expected behavior?
Using a precompiled header, even though the toolchain doesn't support it, should lead to an error.

What went wrong?
If a target tries to use precompiled headers, but the toolchain's tool() for one of the used languages doesn't specify a precompiled_header_type,
the flags variable for that language (e.g. cflags_cc) will always be empty.

E.g.: The cxx tool has no precompiled_header_type variable -> Targets with C++ sources that use precompiled headers will always get an empty cflags_cc variable in the Ninja file.

Did this work before? No 

Chrome version: <Copy from: 'about:version'>  Channel: n/a
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 23.0 r0
 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/52de7c17a1f9e4b3a2ed57d41afd131c0f4f8e69

commit 52de7c17a1f9e4b3a2ed57d41afd131c0f4f8e69
Author: tim <tim@rnc-ag.de>
Date: Wed Oct 12 04:40:40 2016

GN: Fix flags writing for targets with unsupported PCHs

This fixes an issue that led to empty compiler flags being written
in the unusual case of a target with a PCH in conjunction with a toolchain
that doesn't support PCHs.

BUG= 649899 

Review-Url: https://codereview.chromium.org/2410253002
Cr-Commit-Position: refs/heads/master@{#424669}

[modify] https://crrev.com/52de7c17a1f9e4b3a2ed57d41afd131c0f4f8e69/tools/gn/ninja_binary_target_writer.cc

Project Member

Comment 2 by sheriffbot@chromium.org, Oct 12 2017

Status: Archived (was: Unconfirmed)
Issue has not been modified or commented on in the last 365 days, please re-open or file a new bug if this is still an issue.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Sign in to add a comment