Compile cleanly with clang.

To compile Ardour with LLVM/clang, do the usual thing but set the CXX and CC
environment variables, e.g.:

CC=/usr/bin/clang CXX=/usr/bin/clang++ ./waf configure build


git-svn-id: svn://localhost/ardour2/branches/3.0@12418 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2012-05-24 02:54:10 +00:00
parent effe4de188
commit 27a1cf2cf7
46 changed files with 115 additions and 99 deletions

View file

@ -35,7 +35,7 @@
namespace ARDOUR {
class AudioRegion;
class PeakData;
struct PeakData;
};
class AudioTimeAxisView;

View file

@ -35,10 +35,10 @@ namespace Gdk {
}
namespace ARDOUR {
class Route;
class PeakData;
class AudioRegion;
class Route;
class Source;
struct PeakData;
}
class PublicEditor;

View file

@ -26,6 +26,6 @@ namespace ARDOUR {
class AutomationList;
}
struct AutomationSelection : std::list<boost::shared_ptr<ARDOUR::AutomationList> > {};
class AutomationSelection : public std::list<boost::shared_ptr<ARDOUR::AutomationList> > {};
#endif /* __ardour_gtk_automation_selection_h__ */

View file

@ -63,7 +63,7 @@ class AxisView : public virtual Selectable, public PBD::ScopedConnectionList, pu
std::string gui_property (const std::string& property_name) const;
template<typename T> void set_gui_property (const std::string& property_name, const T& value) {
gui_object_state().set<T> (state_id(), property_name, value);
gui_object_state().set_property<T> (state_id(), property_name, value);
}
bool marked_for_display () const;

View file

@ -21,12 +21,13 @@
class Editor;
struct EditorCursor {
Editor& editor;
ArdourCanvas::Points points;
ArdourCanvas::Line canvas_item;
class EditorCursor {
public:
Editor& editor;
ArdourCanvas::Points points;
ArdourCanvas::Line canvas_item;
framepos_t current_frame;
double length;
double length;
EditorCursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
~EditorCursor ();
@ -35,5 +36,5 @@ struct EditorCursor {
void set_length (double units);
void set_y_axis (double position);
PBD::Signal1<void, framepos_t> PositionChanged;
PBD::Signal1<void, framepos_t> PositionChanged;
};

View file

@ -242,8 +242,9 @@ private:
class RegionDrag;
/** Container for details about a region being dragged */
struct DraggingView
class DraggingView
{
public:
DraggingView (RegionView *, RegionDrag *);
RegionView* view; ///< the view

View file

@ -303,7 +303,6 @@ EditorRegions::add_region (boost::shared_ptr<Region> region)
TreeModel::iterator iter = _model->get_iter ("0");
TreeModel::Row parent;
TreeModel::Row child;
if (!iter) {
parent = *(_model->append());
@ -550,7 +549,7 @@ EditorRegions::selection_changed ()
for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
if (iter = _model->get_iter (*i)) {
if ((iter = _model->get_iter (*i))) {
boost::shared_ptr<Region> region = (*iter)[_columns.region];
// they could have clicked on a row that is just a placeholder, like "Hidden"

View file

@ -393,7 +393,7 @@ ExportFormatDialog::init_format_table ()
boost::shared_ptr<HasSampleFormat> hsf;
if (hsf = boost::dynamic_pointer_cast<HasSampleFormat> (*it)) {
if ((hsf = boost::dynamic_pointer_cast<HasSampleFormat> (*it))) {
hsf->SampleFormatSelectChanged.connect (*this, invalidator (*this), boost::bind (&ExportFormatDialog::change_sample_format_selection, this, _1, _2), gui_context());
hsf->SampleFormatCompatibleChanged.connect (*this, invalidator (*this), boost::bind (&ExportFormatDialog::change_sample_format_compatibility, this, _1, _2), gui_context());
@ -832,13 +832,13 @@ ExportFormatDialog::change_encoding_options (ExportFormatPtr ptr)
boost::shared_ptr<ARDOUR::ExportFormatFLAC> flac_ptr;
boost::shared_ptr<ARDOUR::ExportFormatBWF> bwf_ptr;
if (linear_ptr = boost::dynamic_pointer_cast<ExportFormatLinear> (ptr)) {
if ((linear_ptr = boost::dynamic_pointer_cast<ExportFormatLinear> (ptr))) {
show_linear_enconding_options (linear_ptr);
} else if (ogg_ptr = boost::dynamic_pointer_cast<ExportFormatOggVorbis> (ptr)) {
} else if ((ogg_ptr = boost::dynamic_pointer_cast<ExportFormatOggVorbis> (ptr))) {
show_ogg_enconding_options (ogg_ptr);
} else if (flac_ptr = boost::dynamic_pointer_cast<ExportFormatFLAC> (ptr)) {
} else if ((flac_ptr = boost::dynamic_pointer_cast<ExportFormatFLAC> (ptr))) {
show_flac_enconding_options (flac_ptr);
} else if (bwf_ptr = boost::dynamic_pointer_cast<ExportFormatBWF> (ptr)) {
} else if ((bwf_ptr = boost::dynamic_pointer_cast<ExportFormatBWF> (ptr))) {
show_bwf_enconding_options (bwf_ptr);
} else {
std::cout << "Unrecognized format!" << std::endl;

View file

@ -545,7 +545,7 @@ GroupTabs::set_group_color (RouteGroup* group, Gdk::Color color)
char buf[64];
snprintf (buf, sizeof (buf), "%d:%d:%d", color.get_red(), color.get_green(), color.get_blue());
gui_state.set (group_gui_id (group), "color", buf);
gui_state.set_property (group_gui_id (group), "color", buf);
/* the group color change notification */

View file

@ -43,7 +43,7 @@ public:
std::string get_string (const std::string& id, const std::string& prop_name, bool* empty = 0);
template<typename T> void set (const std::string& id, const std::string& prop_name, const T& val) {
template<typename T> void set_property (const std::string& id, const std::string& prop_name, const T& val) {
XMLNode* child = get_or_add_node (id);
std::stringstream s;
s << val;

View file

@ -282,7 +282,7 @@ MidiListEditor::scroll_event (GdkEventScroll* ev)
previous_selection.push_back (*i);
if (iter = model->get_iter (*i)) {
if ((iter = model->get_iter (*i))) {
note = (*iter)[columns._note];
@ -445,7 +445,6 @@ MidiListEditor::key_release (GdkEventKey* ev)
TreeModel::Path path;
TreeViewColumn* col;
TreeModel::iterator iter;
TreeModel::Row row;
MidiModel::NoteDiffCommand* cmd;
boost::shared_ptr<MidiModel> m (region->midi_source(0)->model());
boost::shared_ptr<NoteType> note;
@ -702,7 +701,7 @@ MidiListEditor::edited (const std::string& path, const std::string& text)
TreeView::Selection::ListHandle_Path rows = view.get_selection()->get_selected_rows ();
for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
if (iter = model->get_iter (*i)) {
if ((iter = model->get_iter (*i))) {
note = (*iter)[columns._note];
@ -809,7 +808,7 @@ MidiListEditor::selection_changed ()
NotePlayer* player = new NotePlayer (track);
for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
if (iter = model->get_iter (*i)) {
if ((iter = model->get_iter (*i))) {
note = (*iter)[columns._note];
player->add (note);
}

View file

@ -34,12 +34,12 @@ namespace Gdk {
}
namespace ARDOUR {
class Route;
class Crossfade;
class PeakData;
class MidiRegion;
class Source;
class MidiModel;
class MidiRegion;
class Route;
class Source;
struct PeakData;
}
class PublicEditor;

View file

@ -1171,7 +1171,7 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt
}
if (each_io_has_one_connection) {
if ((total_connection_count == ardour_connection_count)) {
if (total_connection_count == ardour_connection_count) {
// all connections are to the same track in ardour
// "ardour:Master/" -> "Master"
string::size_type slash = ardour_track_name.find("/");

View file

@ -24,7 +24,7 @@
class ControlPoint;
struct PointSelection : public std::list<ControlPoint *>
class PointSelection : public std::list<ControlPoint *>
{
};

View file

@ -22,8 +22,9 @@
#include "ardour/bundle.h"
struct PortMatrixNode
class PortMatrixNode
{
public:
PortMatrixNode () {}
PortMatrixNode (ARDOUR::BundleChannel r, ARDOUR::BundleChannel c) : row (r), column (c) {}

View file

@ -62,31 +62,31 @@ namespace Gtkmm2ext {
class TearOff;
}
class Editor;
class TimeAxisViewItem;
class TimeAxisView;
class PluginUIWindow;
class PluginSelector;
class PlaylistSelector;
class XMLNode;
class Selection;
class AutomationLine;
class ControlPoint;
class SelectionRect;
class RouteTimeAxisView;
class RegionView;
class AudioRegionView;
class TempoMarker;
class MeterMarker;
class Marker;
class AutomationLine;
class AutomationTimeAxisView;
class MarkerTimeAxis;
class ImageFrameView;
class ImageFrameTimeAxis;
class MarkerView;
class ControlPoint;
class DragManager;
class Editor;
class ImageFrameTimeAxis;
class ImageFrameView;
class Marker;
class MarkerTimeAxis;
class MarkerView;
class MeterMarker;
class MouseCursors;
class PlaylistSelector;
class PluginSelector;
class PluginUIWindow;
class RegionView;
class RouteTimeAxisView;
class Selection;
class TempoMarker;
class TimeAxisView;
class TimeAxisViewItem;
class VerboseCursor;
class XMLNode;
struct SelectionRect;
using ARDOUR::framepos_t;
using ARDOUR::framecnt_t;

View file

@ -1347,7 +1347,7 @@ RouteUI::set_color (const Gdk::Color & c)
the time axis view and the mixer strip
*/
gui_object_state().set<string> (route_state_id(), X_("color"), buf);
gui_object_state().set_property<string> (route_state_id(), X_("color"), buf);
_route->gui_changed ("color", (void *) 0); /* EMIT_SIGNAL */
}

View file

@ -34,12 +34,12 @@ namespace Gdk {
}
namespace ARDOUR {
class Route;
class Crossfade;
class PeakData;
class Region;
class Route;
class Source;
class Track;
struct PeakData;
}
struct RecBoxInfo {

View file

@ -101,7 +101,7 @@ VolumeController::dB_printer (char buf[32], const boost::shared_ptr<PBD::Control
}
}
} else {
snprintf (buf, sizeof (buf), "--");
snprintf (buf, 32, "--");
}
}

View file

@ -149,8 +149,9 @@ class Bundle : public PBD::ScopedConnectionList
Change _pending_change;
};
struct BundleChannel
class BundleChannel
{
public:
BundleChannel () : channel (-1) {}
BundleChannel (boost::shared_ptr<Bundle> b, int c)

View file

@ -35,7 +35,8 @@ class ControlProtocol;
class ControlProtocolDescriptor;
class Session;
struct ControlProtocolInfo {
class ControlProtocolInfo {
public:
ControlProtocolDescriptor* descriptor;
ControlProtocol* protocol;
std::string name;

View file

@ -31,8 +31,8 @@
namespace ARDOUR
{
struct ExportStatus {
class ExportStatus {
public:
ExportStatus ();
void init ();

View file

@ -30,7 +30,8 @@
namespace ARDOUR {
struct ImportStatus : public InterThreadInfo {
class ImportStatus : public InterThreadInfo {
public:
std::string doing_what;
/* control info */

View file

@ -27,14 +27,15 @@
namespace ARDOUR {
struct InterThreadInfo {
class InterThreadInfo {
public:
InterThreadInfo () : done (false), cancel (false), progress (0), thread (0) {}
volatile bool done;
volatile bool cancel;
volatile float progress;
pthread_t thread;
ProcessThread process_thread;
ProcessThread process_thread;
};
} // namespace

View file

@ -53,7 +53,8 @@ public:
bool merge_in_place(const MidiBuffer &other);
template<typename BufferType, typename EventType>
struct iterator_base {
class iterator_base {
public:
iterator_base<BufferType, EventType>(BufferType& b, framecnt_t o) : buffer(b), offset(o) {}
inline EventType operator*() const {
uint8_t* ev_start = buffer._data + offset + sizeof(TimeType);

View file

@ -34,8 +34,9 @@ namespace ARDOUR
class Session;
class Playlist;
struct NamedSelection : public PBD::Stateful
class NamedSelection : public PBD::Stateful
{
public:
NamedSelection (std::string, std::list<boost::shared_ptr<Playlist> >&);
NamedSelection (Session&, const XMLNode&);
virtual ~NamedSelection ();

View file

@ -230,12 +230,14 @@ public:
friend class Session;
protected:
struct RegionReadLock : public Glib::RWLock::ReaderLock {
class RegionReadLock : public Glib::RWLock::ReaderLock {
public:
RegionReadLock (Playlist *pl) : Glib::RWLock::ReaderLock (pl->region_lock) {}
~RegionReadLock() {}
};
struct RegionWriteLock : public Glib::RWLock::WriterLock {
class RegionWriteLock : public Glib::RWLock::WriterLock {
public:
RegionWriteLock (Playlist *pl, bool do_block_notify = true)
: Glib::RWLock::WriterLock (pl->region_lock)
, playlist (pl)

View file

@ -16,7 +16,8 @@ namespace ARDOUR {
class Slave;
class Region;
struct SessionEvent {
class SessionEvent {
public:
enum Type {
SetTransportSpeed,
SetTrackSpeed,

View file

@ -213,7 +213,8 @@ namespace ARDOUR {
timecode_60
};
struct AnyTime {
class AnyTime {
public:
enum Type {
Timecode,
BBT,

View file

@ -239,7 +239,7 @@ ExportFormatManager::add_format (ExportFormatPtr ptr)
boost::shared_ptr<HasSampleFormat> hsf;
if (hsf = boost::dynamic_pointer_cast<HasSampleFormat> (ptr)) {
if ((hsf = boost::dynamic_pointer_cast<HasSampleFormat> (ptr))) {
hsf->SampleFormatSelectChanged.connect_same_thread (*this, boost::bind (&ExportFormatManager::change_sample_format_selection, this, _1, _2));
hsf->DitherTypeSelectChanged.connect_same_thread (*this, boost::bind (&ExportFormatManager::change_dither_type_selection, this, _1, _2));
}
@ -682,7 +682,7 @@ ExportFormatManager::selection_changed ()
}
boost::shared_ptr<HasSampleFormat> hsf;
if (hsf = boost::dynamic_pointer_cast<HasSampleFormat> (get_selected_format())) {
if ((hsf = boost::dynamic_pointer_cast<HasSampleFormat> (get_selected_format()))) {
SampleFormatList sf_list = hsf->get_sample_formats();
for (SampleFormatList::iterator it = sf_list.begin(); it != sf_list.end(); ++it) {
@ -747,7 +747,7 @@ ExportFormatManager::get_selected_sample_format ()
{
boost::shared_ptr<HasSampleFormat> hsf;
if (hsf = boost::dynamic_pointer_cast<HasSampleFormat> (get_selected_format())) {
if ((hsf = boost::dynamic_pointer_cast<HasSampleFormat> (get_selected_format()))) {
return hsf->get_selected_sample_format ();
} else {
return SampleFormatPtr ();

View file

@ -112,7 +112,9 @@ mix_buffers_no_gain_t ARDOUR::mix_buffers_no_gain = 0;
PBD::Signal1<void,std::string> ARDOUR::BootMessage;
void ARDOUR::setup_enum_writer ();
namespace ARDOUR {
extern void setup_enum_writer ();
}
/* this is useful for quite a few things that want to check
if any bounds-related property has changed
@ -277,7 +279,7 @@ ARDOUR::init (bool use_windows_vst, bool try_optimization)
Stateful::current_state_version = CURRENT_SESSION_FILE_VERSION;
setup_enum_writer ();
ARDOUR::setup_enum_writer ();
// allow ardour the absolute maximum number of open files
lotsa_files_please ();

View file

@ -21,6 +21,7 @@
#include <algorithm>
#include <iostream>
#include <utility>
#include <stdlib.h>
@ -257,10 +258,7 @@ MidiPlaylist::read (Evoral::EventSink<framepos_t>& dst, framepos_t start, framec
} else {
if (new_tracker) {
pair<Region*,MidiStateTracker*> newpair;
newpair.first = mr.get();
newpair.second = tracker;
_note_trackers.insert (newpair).first;
_note_trackers.insert (make_pair (mr.get(), tracker));
DEBUG_TRACE (DEBUG::MidiPlaylistIO, "\tadded tracker to trackers\n");
}
}

View file

@ -25,9 +25,10 @@
#include "ardour/event_type_map.h"
using namespace std;
using namespace ARDOUR;
using namespace PBD;
namespace ARDOUR {
/** Read a block of MIDI events from this buffer into a MidiBuffer.
*
* Timestamps of events returned are relative to start (i.e. event with stamp 0
@ -279,3 +280,4 @@ MidiRingBuffer<T>::reset_tracker ()
template class MidiRingBuffer<framepos_t>;
} // namespace ARDOUR

View file

@ -121,8 +121,9 @@ protected:
/// A process context that allocates and owns it's data buffer
template <typename T = DefaultSampleType>
struct AllocatingProcessContext : public ProcessContext<T>
class AllocatingProcessContext : public ProcessContext<T>
{
public:
/// Allocates uninitialized memory
AllocatingProcessContext (framecnt_t frames, ChannelCount channels)
: ProcessContext<T> (new T[frames], frames, channels) {}

View file

@ -35,7 +35,8 @@ class Curve;
/** A single event (time-stamped value) for a control
*/
struct ControlEvent {
class ControlEvent {
public:
ControlEvent (double w, double v)
: when (w), value (v), coeff (0)
{}

View file

@ -44,7 +44,8 @@ void init_event_id_counter(event_id_t n);
* Template parameter Time is the type of the time stamp used for this event.
*/
template<typename Time>
struct Event {
class Event {
public:
#ifdef EVORAL_EVENT_ALLOC
Event (EventType type=0, Time time=0, uint32_t size=0, uint8_t* buf=NULL, bool alloc=false);

View file

@ -47,7 +47,7 @@ public:
EventRingBuffer(size_t capacity) : PBD::RingBufferNPT<uint8_t>(capacity)
{}
size_t capacity() const { return bufsize(); }
inline size_t capacity() const { return bufsize(); }
/** Peek at the ringbuffer (read w/o advancing read pointer).
* @return how much has been peeked (wraps around if read exceeds
@ -57,10 +57,10 @@ public:
* read-pointer---^
* </pre>
*/
bool peek (uint8_t*, size_t size);
inline bool peek (uint8_t*, size_t size);
uint32_t write(Time time, EventType type, uint32_t size, const uint8_t* buf);
bool read (Time* time, EventType* type, uint32_t* size, uint8_t* buf);
inline uint32_t write(Time time, EventType type, uint32_t size, const uint8_t* buf);
inline bool read (Time* time, EventType* type, uint32_t* size, uint8_t* buf);
};
template<typename Time>

View file

@ -36,7 +36,8 @@ namespace Evoral {
* valid MIDI data for these functions to make sense.
*/
template<typename Time>
struct MIDIEvent : public Event<Time> {
class MIDIEvent : public Event<Time> {
public:
MIDIEvent(EventType type=0, Time time=0, uint32_t size=0, uint8_t* buf=NULL, bool alloc=false)
: Event<Time>(type, time, size, buf, alloc)
{}

View file

@ -180,7 +180,6 @@ smf_format_vlq(unsigned char *buf, int length, unsigned long value)
}
assert(i <= length);
length = length; // get rid of stupid gcc warnings about unused params if assert() is null
/* + 1, because "i" is an offset, not a count. */
return (i + 1);

View file

@ -26,7 +26,7 @@
#include <boost/bind/protect.hpp>
namespace sigc {
class trackable;
struct trackable;
}
#define ENSURE_GUI_THREAD(obj,method, ...) if (!Gtkmm2ext::UI::instance()->caller_is_self()) { abort (); }

View file

@ -40,6 +40,10 @@ using namespace MIDI;
using namespace std;
using namespace PBD;
namespace Evoral {
template class EventRingBuffer<timestamp_t>;
}
pthread_t JackMIDIPort::_process_thread;
Signal0<void> JackMIDIPort::JackHalted;
Signal0<void> JackMIDIPort::MakeConnections;

View file

@ -37,9 +37,6 @@
#include "pbd/signals.h"
#include "pbd/ringbuffer.h"
#include "evoral/Event.hpp"
#include "evoral/EventRingBuffer.hpp"
#include "midi++/types.h"
#include "midi++/parser.h"
#include "midi++/port.h"

View file

@ -29,9 +29,6 @@
#include "pbd/signals.h"
#include "pbd/ringbuffer.h"
#include "evoral/Event.hpp"
#include "evoral/EventRingBuffer.hpp"
#include "midi++/types.h"
#include "midi++/parser.h"

View file

@ -300,7 +300,7 @@ Parser::process_mtc_quarter_frame (byte *msg)
switch (_mtc_running) {
case MTC_Forward:
if ((which_quarter_frame == 7)) {
if (which_quarter_frame == 7) {
/* we've reached the final of 8 quarter frame messages.
store the time, reset the pending time holder,

View file

@ -146,7 +146,8 @@ class ControlProtocol : public PBD::Stateful, public PBD::ScopedConnectionList,
};
extern "C" {
struct ControlProtocolDescriptor {
class ControlProtocolDescriptor {
public:
const char* name; /* descriptive */
const char* id; /* unique and version-specific */
void* ptr; /* protocol can store a value here */

View file

@ -128,10 +128,11 @@ def set_compiler_flags (conf,opt):
platform = u[0].lower()
version = u[2]
is_clang = conf.env['CXX'][0].endswith('clang++')
if opt.gprofile:
debug_flags = [ '-pg' ]
else:
if platform != 'darwin':
if platform != 'darwin' and not is_clang:
debug_flags = [ '-rdynamic' ] # waf adds -O0 -g itself. thanks waf!
# Autodetect
@ -214,7 +215,7 @@ def set_compiler_flags (conf,opt):
elif cpu == "i686":
optimization_flags.append ("-march=i686")
if ((conf.env['build_target'] == 'i686') or (conf.env['build_target'] == 'x86_64')) and build_host_supports_sse:
if not is_clang and ((conf.env['build_target'] == 'i686') or (conf.env['build_target'] == 'x86_64')) and build_host_supports_sse:
optimization_flags.extend (["-msse", "-mfpmath=sse", "-DUSE_XMMINTRIN"])
debug_flags.extend (["-msse", "-mfpmath=sse", "-DUSE_XMMINTRIN"])