Home / uncrustify
Name Modified Size Downloads / Week Status
Parent folder
uncrustify-0.65 2017-05-18 433433 weekly downloads
uncrustify-0.64 2016-10-14 120120 weekly downloads
uncrustify-0.63 2016-05-10 33 weekly downloads
uncrustify-0.62 2016-02-03 1212 weekly downloads
uncrustify-0.61 2014-12-23 3434 weekly downloads
uncrustify-0.60 2013-01-01 22 weekly downloads
uncrustify-0.59 2011-12-26 33 weekly downloads
uncrustify-0.58 2011-05-20 0
uncrustify-0.57 2010-11-25 0
uncrustify-0.56 2010-03-27 0
uncrustify-0.55 2009-11-28 0
uncrustify-0.54 2009-10-16 0
uncrustify-0.53 2009-07-14 0
uncrustify-0.52 2009-02-28 0
uncrustify-0.51 2008-12-03 0
uncrustify-0.50 2008-10-26 0
uncrustify-0.49 2008-08-23 0
uncrustify-0.48 2008-07-19 0
uncrustify-0.47 2008-06-06 0
uncrustify-0.46 2008-04-22 0
uncrustify-0.45 2008-03-07 0
uncrustify-0.44 2008-02-13 0
uncrustify-0.43 2008-01-09 0
uncrustify-0.42 2007-11-30 0
uncrustify-0.41 2007-11-09 0
uncrustify-0.40 2007-10-13 0
uncrustify-0.39 2007-09-26 0
uncrustify-0.38 2007-09-05 0
uncrustify-0.37 2007-08-17 0
uncrustify-0.36 2007-08-04 0
uncrustify-0.35 2007-07-14 0
uncrustify-0.34 2007-05-12 0
uncrustify-0.33 2007-03-06 0
uncrustify-0.32 2007-02-21 0
uncrustify-0.31 2007-01-25 0
uncrustify-0.30 2006-11-24 0
uncrustify-0.29 2006-10-27 0
uncrustify-0.28 2006-10-07 0
uncrustify-0.27 2006-09-24 0
uncrustify-0.26 2006-09-09 0
Totals: 40 Items   607

README for Uncrustify

Travis CI AppVeyor

Post any bugs to the issue tracker found on the project's GitHub page: https://github.com/uncrustify/uncrustify/issues

Please include the following with your issue: - a description of what is not working right - input code sufficient to demonstrate the issue - expected output code - configuration options used to generate the output

If the issue cannot be easily reproduced, then it isn't likely to be fixed.

Building using CMake

CMake is a tool that generates build systems (Makefiles, Visual Studio project files, and others).

To generate a build system for Uncrustify using CMake, create a build folder and run CMake from it:

.bash $ mkdir build $ cd build $ cmake ..

Then use the build tools of your build system (in many cases this will simply be make, but on Windows it could be MSBuild or Visual Studio). Or use CMake to invoke it:

.bash $ cmake --build .

If testing is enabled, CMake generates a test target, which you can build using your build system tools (usually make test). This can also be invoked using CTest:

.bash $ ctest -V -C Debug

There is also an install target, which can be used to install the Uncrustify executable (typically make install).

A note on CMake configurations

Some build systems are single-configuration, which means you specify the build type when running CMake (by setting the CMAKE_BUILD_TYPE variable), and the generated files then build that configuration.

An example of a single-configuration build system is Makefiles. You can build the Release configuration of Uncrustify (from the build folder) with:

.bash $ cmake -DCMAKE_BUILD_TYPE=Release .. $ make

Other build systems are multi-configuration, which means you specify the build type when building.

An example of a multi-configuration build system is Visual Studio project files. When you open the project in Visual Studio, you can select which configuration to build. You can also do this while building from the command line with cmake --build . --config Release.

Building using Autotools

Quick start: $ ./autogen.sh $ ./configure $ make

The executable is src/uncrustify. Copy that to your ~/bin/ folder or wherever you want.

Building the program using Xcode on Mac OS X

You can of course just open the Xcode project and build uncrustify using the default 'Debug' configuration but if you want to install it the 'Install' configuration will not work from within Xcode.

For that you will have to use the Xcode command line tool 'xcodebuild'.

To do that, cd into the uncrustify project folder where uncrustify.xcodeproj resides and enter the following command:

$ sudo xcodebuild -configuration 'Install'

You will be prompted for the root level password. By doing this you will install uncrustify into /usr/local/bin. The install location can be changed by editing the Build Settings for the uncrustify target. The setting you need to change is called, surprisingly enough, 'Installation Directory'.

Configuring the program

Examine the example config files in etc (such as ben.cfg) and/or read configuration.txt. Copy the existing config file that closely matches your style and put in ~/.uncrustify/. Find complete configuration file options in this file. Modify to your liking.

Running the program (and refining your style)

As of the current release, I don't particularly trust this program to not make mistakes and screw up my whitespace formatting.

Here's how to run it: $ uncrustify -c ~/.uncrustify/mystyle.cfg -f somefile.c > somefile.c.unc

The -c option selects the configuration file. The -f option specifies the input file. The output is sent to stdout. Error messages are sent to stderr.

Use a quality side-by-side diff tool to determine if the program did what you wanted. Repeat until your style is refined.

Running the program (once you've found your style)

Write a script to automate the above. Check out etc/dofiles.sh for an example. That script is used as follows:

  1. navigate one level above your project
  2. make a list of file to process $ find myproj -name "*.[ch]" > files.txt
  3. $ sh etc/dofiles.sh files.txt
  4. Use your favorite diff/merge program to merge in the changes $ xxdiff out/myproj myproj
Source: README.md, updated 2016-10-14

Thanks for helping keep SourceForge clean.

Screenshot instructions:
Red Hat Linux   Ubuntu

Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Briefly describe the problem (required):

Upload screenshot of ad (required):
Select a file, or drag & drop file here.

Please provide the ad click URL, if possible:

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks