Skip to content

zig cc and zig c++ do not use stdout with -o - arguments #20709

Closed

Description

@dasimmet

Zig Version

0.14.0-dev.367+a57479afc

Steps to Reproduce and Observed Behavior

When running zig cc or zig c++ with -o -, arguments, the output should be written to stdout, like regular clang or even zig clang does.

With an empty test.h file:

zig c++ -E -x c++-header test.h -o -

this produces a file named - in the current working directory instead, which is especially annoying with running cmake, since it uses CC/CXX with -o - arguments to find compiler features and the c++ standard library.

Expected Behavior

clang-18 -E -x c++-header test.h -o -
zig [clang/c++/cc] -E -x c++-header test.h -o -

output:

# 1 "test.h"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 454 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "test.h" 2

Activity

  1. added
    bug
    on Jul 21, 2024
  2. added
    zig cc
    on Jul 26, 2024
  3. added this to the 0.16.0 milestone on Jul 26, 2024
  4. modified the milestones: 0.16.0, 0.14.0 on Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzig cc

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions