Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command line options for printing help (-h, --help) #1899

Merged
merged 1 commit into from
May 11, 2017

Conversation

krig
Copy link
Contributor

@krig krig commented May 11, 2017

Having commands for outputting help text from the compiler
enables using help2man to generate a man page.

Having commands for outputting help text from the compiler
enables using help2man to generate a man page.
@SeanTAllen
Copy link
Member

This already exists in that any unknown option will print out the help message. So for example,

ponyc --help

results in

Unrecognised option: --help
ponyc [OPTIONS] <package directory>

The package directory defaults to the current directory.

Options:
  --version, -v   Print the version of the compiler and exit.
  --debug, -d     Don't optimise the output.
  --define, -D    Define the specified build flag.
    =name
  --strip, -s     Strip debug info.
  --path, -p      Add an additional search path.
    =path         Used to find packages and libraries.
  --output, -o    Write output to this directory.
    =path         Defaults to the current directory.
  --library, -l   Generate a C-API compatible static library.
  --export, -e    Generate exported functions.
  --runtimebc     Compile with the LLVM bitcode file for the runtime.
  --pic           Compile using position independent code.
  --docs, -g      Generate code documentation.

Rarely needed options:
  --safe          Allow only the listed packages to use C FFI.
    =package      With no packages listed, only builtin is allowed.
  --ieee-math     Force strict IEEE 754 compliance.
  --cpu           Set the target CPU.
    =name         Default is the host CPU.
  --features      CPU features to enable or disable.
    =+this,-that  Use + to enable, - to disable.
  --triple        Set the target triple.
    =name         Defaults to the host triple.
  --stats         Print some compiler stats.
  --link-arch     Set the linking architecture.
    =name         Default is the host architecture.
  --linker        Set the linker command to use.
    =name         Default is the compiler used to compile ponyc.

Debugging options:
  --verbose, -V   Verbosity level.
    =0            Only print errors.
    =1            Print info on compiler stages.
    =2            More detailed compilation information.
    =3            External tool command lines.
    =4            Very low-level detail.
  --pass, -r      Restrict phases.
    =parse
    =syntax
    =sugar
    =scope
    =import
    =name
    =flatten
    =traits
    =docs
    =expr
    =verify
    =final
    =reach
    =paint
    =ir           Output LLVM IR.
    =bitcode      Output LLVM bitcode.
    =asm          Output assembly.
    =obj          Output an object file.
    =all          The default: generate an executable.
  --ast, -a       Output an abstract syntax tree for the whole program.
  --astpackage    Output an abstract syntax tree for the main package.
  --trace, -t     Enable parse trace.
  --width, -w     Width to target when printing the AST.
    =columns      Defaults to the terminal width.
  --immerr        Report errors immediately rather than deferring.
  --verify        Verify LLVM IR.
  --extfun        Set function default linkage to external.
  --files         Print source file names as each is processed.
  --bnf           Print out the Pony grammar as human readable BNF.
  --antlr         Print out the Pony grammar as an ANTLR file.

Runtime options for Pony programs (not for use with ponyc):
  --ponythreads   Use N scheduler threads. Defaults to the number of
                  cores (not hyperthreads) available.
  --ponycdmin     Defer cycle detection until 2^N actors have blocked.
                  Defaults to 2^4.
  --ponycdmax     Always cycle detect when 2^N actors have blocked.
                  Defaults to 2^18.
  --ponycdconf    Send cycle detection CNF messages in groups of 2^N.
                  Defaults to 2^6.
  --ponygcinitial Defer garbage collection until an actor is using at
                  least 2^N bytes. Defaults to 2^14.
  --ponygcfactor  After GC, an actor will next be GC'd at a heap memory
                  usage N times its current value. This is a floating
                  point value. Defaults to 2.0.
  --ponynoyield   Do not yield the CPU when no work is available.
  --ponynoblock   Do not send block messages to the cycle detector.
  --ponynopin     Do not pin scheduler threads or the ASIO thread, even
                  if --ponypinasio is set.
                  threads are pinned to CPUs.
  --ponypinasio   Pin the ASIO thread to a CPU the way scheduler
                  threads are pinned to CPUs.

Is there a reason for needing the explicit command?

@krig
Copy link
Contributor Author

krig commented May 11, 2017

The "Unrecognized option: --help" line confuses help2man.

@SeanTAllen
Copy link
Member

@krig makes sense

@SeanTAllen
Copy link
Member

Thanks for the contribution @krig!

@SeanTAllen SeanTAllen merged commit 3581b6d into ponylang:master May 11, 2017
SeanTAllen added a commit that referenced this pull request May 11, 2017
@SeanTAllen
Copy link
Member

I forgot to tag this to add changelog entry. I manually added just now.

@krig
Copy link
Contributor Author

krig commented May 11, 2017

Great, thank you!

@krig krig deleted the help-directive branch May 11, 2017 12:38
@jemc
Copy link
Member

jemc commented May 11, 2017

After this change, I'm seeing the following compile error locally:

src/ponyc/main.c:104:5: error: string literal of length 4114 exceeds maximum length 4095 that ISO C99 compilers are
      required to support [-Werror,-Woverlength-strings]
    "ponyc [OPTIONS] <package directory>\n"
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We'll have to come up with a fix for this (by splitting the string literal into multiple parts) before the next release, so others with the same compiler settings as me can compile ponyc.

EDIT: opened #1900 to address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants